magellan icon indicating copy to clipboard operation
magellan copied to clipboard

Format not parsed correctly

Open nickdos opened this issue 9 years ago • 2 comments

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

nickdos avatar Jan 21 '16 00:01 nickdos

Fixed with change to line 18:

var DD_FORMAT_REGEX = /^([+-]?\d{1,3})(.\d+)?\s*[NSEW]?$/;

nickdos avatar Jan 21 '16 00:01 nickdos

That should be line 15 on the current source (as of 3/8/17). But yes, this does fix tihngs.

mechalas avatar Mar 08 '17 14:03 mechalas