From 5348dffdae0365c1f306aa47de8f042a847f04c8 Mon Sep 17 00:00:00 2001 From: madwasp79 Date: Wed, 6 Mar 2019 13:03:50 +0200 Subject: [PATCH] Issue #6522 - Interpretation of eastern longitudes in google maps urls is wrong - fixed --- .../src/main/java/net/osmand/util/GeoPointParserUtil.java | 4 ++-- .../src/test/java/net/osmand/util/GeoPointParserUtilTest.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/util/GeoPointParserUtil.java b/OsmAnd-java/src/main/java/net/osmand/util/GeoPointParserUtil.java index f6ac336605..d560d36332 100644 --- a/OsmAnd-java/src/main/java/net/osmand/util/GeoPointParserUtil.java +++ b/OsmAnd-java/src/main/java/net/osmand/util/GeoPointParserUtil.java @@ -646,9 +646,9 @@ public class GeoPointParserUtil { private static double parseLon(String lonString) { if (lonString.startsWith("E")) { - return -Double.valueOf(lonString.substring(1)); - } else if (lonString.startsWith("W")) { return Double.valueOf(lonString.substring(1)); + } else if (lonString.startsWith("W")) { + return -Double.valueOf(lonString.substring(1)); } return Double.valueOf(lonString); } diff --git a/OsmAnd-java/src/test/java/net/osmand/util/GeoPointParserUtilTest.java b/OsmAnd-java/src/test/java/net/osmand/util/GeoPointParserUtilTest.java index a2e7469cfc..98ba6ed87e 100644 --- a/OsmAnd-java/src/test/java/net/osmand/util/GeoPointParserUtilTest.java +++ b/OsmAnd-java/src/test/java/net/osmand/util/GeoPointParserUtilTest.java @@ -269,7 +269,7 @@ public class GeoPointParserUtilTest { url = "http://maps.google.com/maps?q=N" + dlat + ",E" + Math.abs(dlon); System.out.println("url: " + 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"; System.out.println("url: " + url);