magellan
magellan copied to clipboard
Format not parsed correctly
I have an example user input that does not return the expected DD output:
input coordinates: 36.01S,146.95E
- this is recognised by Google geocoding API.
var parts = address.split(",");
var lat = magellan(parts[0]).latitude().toDD();
var lng = magellan(parts[1]).longitude().toDD();
console.log("magellan", parts, lat, lng);
console output:
magellan ["36.01S", "146.95E"] -3.100167 14.115833`
the following does work correctly:
magellan ["-36.01", "146.95"] -36.010000 146.950000
magellan ["36°1'S", "146°57'E"] -36.016667 146.950000
Fixed with change to line 18:
var DD_FORMAT_REGEX = /^([+-]?\d{1,3})(.\d+)?\s*[NSEW]?$/;
That should be line 15 on the current source (as of 3/8/17). But yes, this does fix tihngs.