Fixes #2255
This commit is contained in:
parent
a45b321bd4
commit
38adf0b04a
2 changed files with 10 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
||||||
apply plugin: 'java'
|
apply plugin: 'java'
|
||||||
apply plugin: 'application'
|
apply plugin: 'application'
|
||||||
mainClassName = "net.osmand.util.OpeningHoursParser"
|
mainClassName = "net.osmand.util.GeoPointParserUtil"
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
main {
|
main {
|
||||||
|
|
|
@ -423,6 +423,13 @@ public class GeoPointParserUtil {
|
||||||
actual = GeoPointParserUtil.parse(url);
|
actual = GeoPointParserUtil.parse(url);
|
||||||
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
|
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
|
// http://www.google.com/maps/search/food/34,-106,14z
|
||||||
url = "http://www.google.com/maps/search/food/" + ilat + "," + ilon + "," + z + "z";
|
url = "http://www.google.com/maps/search/food/" + ilat + "," + ilon + "," + z + "z";
|
||||||
System.out.println("url: " + url);
|
System.out.println("url: " + url);
|
||||||
|
@ -794,7 +801,7 @@ public class GeoPointParserUtil {
|
||||||
private static Map<String, String> getQueryParameters(String query) {
|
private static Map<String, String> getQueryParameters(String query) {
|
||||||
final LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
|
final LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
|
||||||
if (query != null && !query.equals("")) {
|
if (query != null && !query.equals("")) {
|
||||||
String[] params = query.split("&");
|
String[] params = query.split("[&/]");
|
||||||
for (String p : params) {
|
for (String p : params) {
|
||||||
String[] keyValue = p.split("=");
|
String[] keyValue = p.split("=");
|
||||||
if (keyValue.length == 1)
|
if (keyValue.length == 1)
|
||||||
|
@ -936,6 +943,7 @@ public class GeoPointParserUtil {
|
||||||
String z = String.valueOf(GeoParsedPoint.NO_ZOOM);
|
String z = String.valueOf(GeoParsedPoint.NO_ZOOM);
|
||||||
Map<String, String> params = getQueryParameters(uri);
|
Map<String, String> params = getQueryParameters(uri);
|
||||||
if (params.containsKey("q")) {
|
if (params.containsKey("q")) {
|
||||||
|
System.out.println("q=" + params.get("q"));
|
||||||
Matcher matcher = commaSeparatedPairPattern.matcher(params.get("q"));
|
Matcher matcher = commaSeparatedPairPattern.matcher(params.get("q"));
|
||||||
if (matcher.matches()) {
|
if (matcher.matches()) {
|
||||||
latString = matcher.group(1);
|
latString = matcher.group(1);
|
||||||
|
|
Loading…
Reference in a new issue