From 38adf0b04a619aad7e5e6a75f1365b4571c61aac Mon Sep 17 00:00:00 2001 From: GaidamakUA Date: Thu, 10 Mar 2016 19:31:02 +0200 Subject: [PATCH] Fixes #2255 --- OsmAnd-java/build.gradle | 2 +- .../src/net/osmand/util/GeoPointParserUtil.java | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/OsmAnd-java/build.gradle b/OsmAnd-java/build.gradle index 7df1fbdd62..0deaef3eea 100644 --- a/OsmAnd-java/build.gradle +++ b/OsmAnd-java/build.gradle @@ -1,6 +1,6 @@ apply plugin: 'java' apply plugin: 'application' -mainClassName = "net.osmand.util.OpeningHoursParser" +mainClassName = "net.osmand.util.GeoPointParserUtil" sourceSets { main { diff --git a/OsmAnd-java/src/net/osmand/util/GeoPointParserUtil.java b/OsmAnd-java/src/net/osmand/util/GeoPointParserUtil.java index 2b24b73073..5511156f8c 100644 --- a/OsmAnd-java/src/net/osmand/util/GeoPointParserUtil.java +++ b/OsmAnd-java/src/net/osmand/util/GeoPointParserUtil.java @@ -423,6 +423,13 @@ public class GeoPointParserUtil { actual = GeoPointParserUtil.parse(url); assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z)); + // whatsapp + // https://www.google.com/maps/search/34.99393,-106.61568/data=!4m4!2m3!3m1!2s-23.2776,-45.8443128!4b1 + url = "https://maps.google.com/maps?q=loc:" + dlat + "," + dlon + "/data=!4m4!2m3!3m1!2s-23.2776,-45.8443128!4b1"; + System.out.println("url: " + url); + actual = GeoPointParserUtil.parse(url); + assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z)); + // http://www.google.com/maps/search/food/34,-106,14z url = "http://www.google.com/maps/search/food/" + ilat + "," + ilon + "," + z + "z"; System.out.println("url: " + url); @@ -794,7 +801,7 @@ public class GeoPointParserUtil { private static Map getQueryParameters(String query) { final LinkedHashMap map = new LinkedHashMap(); if (query != null && !query.equals("")) { - String[] params = query.split("&"); + String[] params = query.split("[&/]"); for (String p : params) { String[] keyValue = p.split("="); if (keyValue.length == 1) @@ -936,6 +943,7 @@ public class GeoPointParserUtil { String z = String.valueOf(GeoParsedPoint.NO_ZOOM); Map params = getQueryParameters(uri); if (params.containsKey("q")) { + System.out.println("q=" + params.get("q")); Matcher matcher = commaSeparatedPairPattern.matcher(params.get("q")); if (matcher.matches()) { latString = matcher.group(1);