[#429,map,bugfix][s]: parse negative lat/lon strings correctly - fixes #429.

This commit is contained in:
Rufus Pollock 2014-06-01 19:58:45 +01:00
parent 01741bcc17
commit ae8f51bf05
2 changed files with 4 additions and 1 deletions

View File

@ -334,7 +334,7 @@ my.Map = Backbone.View.extend({
if (typeof(coord) != 'string') {
return(parseFloat(coord));
}
var dms = coord.split(/[^\.\d\w]+/);
var dms = coord.split(/[^-?\.\d\w]+/);
var deg = 0; var m = 0;
var toDeg = [1, 60, 3600]; // conversion factors for Deg, min, sec
var i;

View File

@ -112,7 +112,10 @@ test('_getGeometryFromRecord non-GeoJSON', function () {
[{ lon: 47, lat: 53}, [47,53]],
[{ lon: -47, lat: 53}, [-47,53]],
["53.3,47.32", [47.32, 53.3]],
["53.3,-47.32", [-47.32, 53.3]],
["53.3, 47.32", [47.32, 53.3]],
["-53.3, 47.32", [47.32, -53.3]],
["53.3, -47.32", [-47.32, 53.3]],
["(53.3,47.32)", [47.32, 53.3]],
[[53.3,47.32], [53.3, 47.32]],
["53.3 N, 113.5 W", [-113.5, 53.3]],