Issue #6522 - Interpretation of eastern longitudes in google maps urls is wrong - fixed

This commit is contained in:
madwasp79 2019-03-06 13:03:50 +02:00
parent 3dff5cd7bb
commit 5348dffdae
2 changed files with 3 additions and 3 deletions

View file

@ -646,9 +646,9 @@ public class GeoPointParserUtil {
private static double parseLon(String lonString) { private static double parseLon(String lonString) {
if (lonString.startsWith("E")) { if (lonString.startsWith("E")) {
return -Double.valueOf(lonString.substring(1));
} else if (lonString.startsWith("W")) {
return Double.valueOf(lonString.substring(1)); return Double.valueOf(lonString.substring(1));
} else if (lonString.startsWith("W")) {
return -Double.valueOf(lonString.substring(1));
} }
return Double.valueOf(lonString); return Double.valueOf(lonString);
} }

View file

@ -269,7 +269,7 @@ public class GeoPointParserUtilTest {
url = "http://maps.google.com/maps?q=N" + dlat + ",E" + Math.abs(dlon); url = "http://maps.google.com/maps?q=N" + dlat + ",E" + Math.abs(dlon);
System.out.println("url: " + url); System.out.println("url: " + url);
actual = GeoPointParserUtil.parse(url); actual = GeoPointParserUtil.parse(url);
assertGeoPoint(actual, new GeoParsedPoint(dlat, -Math.abs(dlon))); assertGeoPoint(actual, new GeoParsedPoint(dlat, Math.abs(dlon)));
url = "http://maps.google.com/maps?f=d&saddr=" + dlat +"," +dlon +"&daddr=" +dlat +"," +dlon+"&hl=en"; url = "http://maps.google.com/maps?f=d&saddr=" + dlat +"," +dlon +"&daddr=" +dlat +"," +dlon+"&hl=en";
System.out.println("url: " + url); System.out.println("url: " + url);