This commit is contained in:
GaidamakUA 2016-03-10 19:31:02 +02:00
parent a45b321bd4
commit 38adf0b04a
2 changed files with 10 additions and 2 deletions

View file

@ -1,6 +1,6 @@
apply plugin: 'java'
apply plugin: 'application'
mainClassName = "net.osmand.util.OpeningHoursParser"
mainClassName = "net.osmand.util.GeoPointParserUtil"
sourceSets {
main {

View file

@ -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<String, String> getQueryParameters(String query) {
final LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
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<String, String> 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);