From 93d0c3ddbd6e909ab97ebddb4676606800afff26 Mon Sep 17 00:00:00 2001 From: PavelRatushny Date: Thu, 7 Sep 2017 10:28:20 +0300 Subject: [PATCH] Add support for city search from openstreetmap --- OsmAnd-java/src/net/osmand/util/GeoPointParserUtil.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/OsmAnd-java/src/net/osmand/util/GeoPointParserUtil.java b/OsmAnd-java/src/net/osmand/util/GeoPointParserUtil.java index 197e8381b6..af70f9ec47 100644 --- a/OsmAnd-java/src/net/osmand/util/GeoPointParserUtil.java +++ b/OsmAnd-java/src/net/osmand/util/GeoPointParserUtil.java @@ -569,6 +569,13 @@ public class GeoPointParserUtil { actual = GeoPointParserUtil.parse(url); assertGeoPoint(actual, new GeoParsedPoint(qstr)); + // http://www.openstreetmap.org/search?query=Amsterdam + qstr = "Amsterdam"; + url = "http://www.openstreetmap.org/search?query=" + URLEncoder.encode(qstr); + System.out.println("url: " + url); + actual = GeoPointParserUtil.parse(url); + assertGeoPoint(actual, new GeoParsedPoint(qstr)); + // http://maps.google.com/maps?daddr=760+West+Genesee+Street+Syracuse+NY+13204 qstr = "760 West Genesee Street Syracuse NY 13204"; url = "http://www.google.com/maps?daddr=" + URLEncoder.encode(qstr); @@ -952,6 +959,8 @@ public class GeoPointParserUtil { if (vls != null && vls.length >= 2) { lat = parseSilentDouble(vls[0]); lon = parseSilentDouble(vls[1]); + } else { + return new GeoParsedPoint(URLEncoder.encode(queryStr)); } } }