|
|
|
@ -3,6 +3,7 @@ package net.osmand.util;
|
|
|
|
|
import java.net.URI;
|
|
|
|
|
import java.net.URLDecoder;
|
|
|
|
|
import java.net.URLEncoder;
|
|
|
|
|
import java.util.Locale;
|
|
|
|
|
import java.util.regex.Matcher;
|
|
|
|
|
import java.util.regex.Pattern;
|
|
|
|
|
|
|
|
|
@ -10,7 +11,8 @@ public class GeoPointParserUtil {
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
final int ilat = 34, ilon = -106;
|
|
|
|
|
final double dlat = 34.99, dlon = -106.61;
|
|
|
|
|
final double dlat = 34.99393, dlon = -106.61568;
|
|
|
|
|
final double longLat = 34.993933029174805, longLon = -106.615680694580078;
|
|
|
|
|
final String name = "Treasure Island";
|
|
|
|
|
int z = GeoParsedPoint.NO_ZOOM;
|
|
|
|
|
String url;
|
|
|
|
@ -18,68 +20,68 @@ public class GeoPointParserUtil {
|
|
|
|
|
// geo:34,-106
|
|
|
|
|
url = "geo:" + ilat + "," + ilon;
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
GeoParsedPoint actual = GeoPointParserUtil.parse("geo", url);
|
|
|
|
|
GeoParsedPoint actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon));
|
|
|
|
|
|
|
|
|
|
// geo:34.99,-106.61
|
|
|
|
|
// geo:34.99393,-106.61568
|
|
|
|
|
url = "geo:" + dlat + "," + dlon;
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse("geo", url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon));
|
|
|
|
|
|
|
|
|
|
// geo:34.99,-106.61?z=11
|
|
|
|
|
// geo:34.99393,-106.61568?z=11
|
|
|
|
|
z = 11;
|
|
|
|
|
url = "geo:" + dlat + "," + dlon + "?z=" + z;
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse("geo", url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
|
|
|
|
|
|
|
|
|
|
// geo:34.99,-106.61 (Treasure Island)
|
|
|
|
|
// geo:34.99393,-106.61568 (Treasure Island)
|
|
|
|
|
url = "geo:" + dlat + "," + dlon + " (" + name + ")";
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse("geo", url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, name));
|
|
|
|
|
|
|
|
|
|
// geo:34.99,-106.61?z=11 (Treasure Island)
|
|
|
|
|
// geo:34.99393,-106.61568?z=11 (Treasure Island)
|
|
|
|
|
z = 11;
|
|
|
|
|
url = "geo:" + dlat + "," + dlon + "?z=" + z + " (" + name + ")";
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse("geo", url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z, name));
|
|
|
|
|
|
|
|
|
|
// geo:34.99,-106.61?q=34.99%2C-106.61 (Treasure Island)
|
|
|
|
|
// geo:34.99393,-106.61568?q=34.99393%2C-106.61568 (Treasure Island)
|
|
|
|
|
z = GeoParsedPoint.NO_ZOOM;
|
|
|
|
|
url = "geo:" + dlat + "," + dlon + "?q=" + dlat + "%2C" + dlon + " (" + name + ")";
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse("geo", url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z, name));
|
|
|
|
|
|
|
|
|
|
// 0,0?q=34,-106(Treasure Island)
|
|
|
|
|
z = GeoParsedPoint.NO_ZOOM;
|
|
|
|
|
url = "geo:0,0?q=" + ilat + "," + ilon + " (" + name + ")";
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse("geo", url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon, z, name));
|
|
|
|
|
|
|
|
|
|
// 0,0?q=34.99,-106.61(Treasure Island)
|
|
|
|
|
// 0,0?q=34.99393,-106.61568(Treasure Island)
|
|
|
|
|
z = GeoParsedPoint.NO_ZOOM;
|
|
|
|
|
url = "geo:0,0?q=" + dlat + "," + dlon + " (" + name + ")";
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse("geo", url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z, name));
|
|
|
|
|
|
|
|
|
|
// geo:0,0?z=11&q=34.99,-106.61(Treasure Island)
|
|
|
|
|
// geo:0,0?z=11&q=34.99393,-106.61568(Treasure Island)
|
|
|
|
|
z = 11;
|
|
|
|
|
url = "geo:0,0?z=" + z + "&q=" + dlat + "," + dlon + " (" + name + ")";
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse("geo", url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z, name));
|
|
|
|
|
|
|
|
|
|
// geo:0,0?z=11&q=34.99,-106.61
|
|
|
|
|
// geo:0,0?z=11&q=34.99393,-106.61568
|
|
|
|
|
z = 11;
|
|
|
|
|
url = "geo:0,0?z=" + z + "&q=" + dlat + "," + dlon;
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse("geo", url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
|
|
|
|
|
|
|
|
|
|
// google calendar
|
|
|
|
@ -87,14 +89,14 @@ public class GeoPointParserUtil {
|
|
|
|
|
String qstr = "760 West Genesee Street Syracuse NY 13204";
|
|
|
|
|
url = "geo:0,0?q=" + qstr;
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse("geo", url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(qstr));
|
|
|
|
|
|
|
|
|
|
// geo:0,0?z=11&q=1600+Amphitheatre+Parkway,+CA
|
|
|
|
|
qstr = "1600 Amphitheatre Parkway, CA";
|
|
|
|
|
url = "geo:0,0?z=11&q=" + URLEncoder.encode(qstr);
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse("geo", url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(qstr));
|
|
|
|
|
|
|
|
|
|
// geo:50.451300,30.569900?z=15&q=50.451300,30.569900 (Kiev)
|
|
|
|
@ -105,85 +107,140 @@ public class GeoPointParserUtil {
|
|
|
|
|
|
|
|
|
|
url = "geo:50.451300,30.569900?z=15&q=50.451300,30.569900 (Kiev)";
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse("geo", url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(qlat, qlon, z, qname));
|
|
|
|
|
|
|
|
|
|
// http://download.osmand.net/go?lat=34&lon=-106&z=11
|
|
|
|
|
url = "http://download.osmand.net/go?lat=" + ilat + "&lon=" + ilon + "&z=" + z;
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse("http", url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon, z));
|
|
|
|
|
|
|
|
|
|
// http://download.osmand.net/go?lat=34.99&lon=-106.61&z=11
|
|
|
|
|
// http://download.osmand.net/go?lat=34.99393&lon=-106.61568&z=11
|
|
|
|
|
url = "http://download.osmand.net/go?lat=" + dlat + "&lon=" + dlon + "&z=" + z;
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse("http", url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
|
|
|
|
|
|
|
|
|
|
// http://openstreetmap.org/map=11/34/-106
|
|
|
|
|
url = "http://openstreetmap.org/map=" + z + "/" + ilat + "/" + ilon;
|
|
|
|
|
// http://openstreetmap.org/#map=11/34/-106
|
|
|
|
|
z = 11;
|
|
|
|
|
url = "http://openstreetmap.org/#map=" + z + "/" + ilat + "/" + ilon;
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse("http", url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon, z));
|
|
|
|
|
|
|
|
|
|
// http://openstreetmap.org/map=11/34.99/-106.61
|
|
|
|
|
url = "http://openstreetmap.org/map=" + z + "/" + dlat + "/" + dlon;
|
|
|
|
|
// http://openstreetmap.org/#map=11/34.99393/-106.61568
|
|
|
|
|
url = "http://openstreetmap.org/#map=" + z + "/" + dlat + "/" + dlon;
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse("http", url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
|
|
|
|
|
|
|
|
|
|
// http://openstreetmap.org/#11/34.99393/-106.61568
|
|
|
|
|
url = "http://openstreetmap.org/#" + z + "/" + dlat + "/" + dlon;
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
|
|
|
|
|
|
|
|
|
|
// https://www.openstreetmap.org/#map=11/49.563/17.291
|
|
|
|
|
url = "https://www.openstreetmap.org/#map=" + z + "/" + dlat + "/" + dlon;
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
|
|
|
|
|
|
|
|
|
|
// https://www.openstreetmap.org/?mlat=34.993933029174805&mlon=-106.61568069458008#map=11/34.99393/-106.61568
|
|
|
|
|
url = "https://www.openstreetmap.org/?mlat=" + longLat + "&mlon=" + longLon
|
|
|
|
|
+ "#map=" + z + "/" + dlat + "/" + dlon;
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
|
|
|
|
|
|
|
|
|
|
// https://wiki.openstreetmap.org/wiki/Shortlink
|
|
|
|
|
|
|
|
|
|
// http://osm.org/go/TyFSutZ-?m=
|
|
|
|
|
// https://www.openstreetmap.org/?mlat=34.993933029174805&mlon=-106.61568069458008#map=15/34.99393/-106.61568
|
|
|
|
|
z = 15;
|
|
|
|
|
url = "http://osm.org/go/TyFYuF6P--?m=";
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertApproximateGeoPoint(actual, new GeoParsedPoint(longLat, longLon, z));
|
|
|
|
|
|
|
|
|
|
// http://osm.org/go/TyFS--
|
|
|
|
|
// http://www.openstreetmap.org/#map=3/34.99/-106.70
|
|
|
|
|
z = 3;
|
|
|
|
|
url = "http://osm.org/go/TyFS--";
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertApproximateGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
|
|
|
|
|
|
|
|
|
|
// http://osm.org/go/TyFYuF6P~~-?m // current shortlink format with "~"
|
|
|
|
|
// https://www.openstreetmap.org/?mlat=34.993933029174805&mlon=-106.61568069458008#map=15/34.99393/-106.61568
|
|
|
|
|
z = 20;
|
|
|
|
|
url = "http://osm.org/go/TyFYuF6P~~-?m";
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertApproximateGeoPoint(actual, new GeoParsedPoint(longLat, longLon, z));
|
|
|
|
|
|
|
|
|
|
// http://osm.org/go/TyFYuF6P@@--?m= // old, deprecated shortlink format with "@"
|
|
|
|
|
// https://www.openstreetmap.org/?mlat=34.993933029174805&mlon=-106.61568069458008#map=15/34.99393/-106.61568
|
|
|
|
|
z = 21;
|
|
|
|
|
url = "http://osm.org/go/TyFYuF6P@@--?m=";
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertApproximateGeoPoint(actual, new GeoParsedPoint(longLat, longLon, z));
|
|
|
|
|
|
|
|
|
|
// http://openstreetmap.de/zoom=11&lat=34&lon=-106
|
|
|
|
|
z = 11;
|
|
|
|
|
url = "http://openstreetmap.de/zoom=" + z + "&lat=" + ilat + "&lon=" + ilon;
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse("http", url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon, z));
|
|
|
|
|
|
|
|
|
|
// http://openstreetmap.de/zoom=11&lat=34.99&lon=-106.61
|
|
|
|
|
// http://openstreetmap.de/zoom=11&lat=34.99393&lon=-106.61568
|
|
|
|
|
url = "http://openstreetmap.de/zoom=" + z + "&lat=" + dlat + "&lon=" + dlon;
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse("http", url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
|
|
|
|
|
|
|
|
|
|
// http://openstreetmap.de/lat=34.99&lon=-106.61&zoom=11
|
|
|
|
|
// http://openstreetmap.de/lat=34.99393&lon=-106.61568&zoom=11
|
|
|
|
|
url = "http://openstreetmap.de/lat=" + dlat + "&lon=" + dlon + "&zoom=" + z;
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse("http", url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
|
|
|
|
|
|
|
|
|
|
// http://maps.google.com/maps/@34,-106,11z
|
|
|
|
|
url = "http://maps.google.com/maps/@" + ilat + "," + ilon + "," + z + "z";
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse("http", url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon, z));
|
|
|
|
|
|
|
|
|
|
// http://maps.google.com/maps/@34.99,-106.61,11z
|
|
|
|
|
// http://maps.google.com/maps/@34.99393,-106.61568,11z
|
|
|
|
|
url = "http://maps.google.com/maps/@" + dlat + "," + dlon + "," + z + "z";
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse("http", url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
|
|
|
|
|
|
|
|
|
|
// http://maps.google.com/maps/ll=34,-106,z=11
|
|
|
|
|
url = "http://maps.google.com/maps/ll=" + ilat + "," + ilon + ",z=" + z;
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse("http", url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon, z));
|
|
|
|
|
|
|
|
|
|
// http://maps.google.com/maps/ll=34.99,-106.61,z=11
|
|
|
|
|
// http://maps.google.com/maps/ll=34.99393,-106.61568,z=11
|
|
|
|
|
url = "http://maps.google.com/maps/ll=" + dlat + "," + dlon + ",z=" + z;
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse("http", url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
|
|
|
|
|
|
|
|
|
|
// http://maps.google.com/maps/q=loc:34,-106&z=11
|
|
|
|
|
url = "http://maps.google.com/maps/q=loc:" + ilat + "," + ilon + "&z=" + z;
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse("http", url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon, z));
|
|
|
|
|
|
|
|
|
|
// http://maps.google.com/maps/q=loc:34.99,-106.61&z=11
|
|
|
|
|
// http://maps.google.com/maps/q=loc:34.99393,-106.61568&z=11
|
|
|
|
|
url = "http://maps.google.com/maps/q=loc:" + dlat + "," + dlon + "&z=" + z;
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse("http", url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
|
|
|
|
|
|
|
|
|
|
// whatsapp
|
|
|
|
@ -191,112 +248,158 @@ public class GeoPointParserUtil {
|
|
|
|
|
z = GeoParsedPoint.NO_ZOOM;
|
|
|
|
|
url = "http://maps.google.com/maps/q=loc:" + ilat + "," + ilon + " (You)";
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse("http", url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon, z));
|
|
|
|
|
|
|
|
|
|
// whatsapp
|
|
|
|
|
// http://maps.google.com/maps/q=loc:34.99,-106.61 (You)
|
|
|
|
|
// http://maps.google.com/maps/q=loc:34.99393,-106.61568 (You)
|
|
|
|
|
z = GeoParsedPoint.NO_ZOOM;
|
|
|
|
|
url = "http://maps.google.com/maps/q=loc:" + dlat + "," + dlon + " (You)";
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse("http", 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);
|
|
|
|
|
actual = GeoPointParserUtil.parse("http", url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon, z));
|
|
|
|
|
|
|
|
|
|
// http://www.google.com/maps/search/food/34.99,-106.61,14z
|
|
|
|
|
// http://www.google.com/maps/search/food/34.99393,-106.61568,14z
|
|
|
|
|
url = "http://www.google.com/maps/search/food/" + dlat + "," + dlon + "," + z + "z";
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse("http", url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
|
|
|
|
|
|
|
|
|
|
// http://maps.google.com?saddr=Current+Location&daddr=34,-106
|
|
|
|
|
z = GeoParsedPoint.NO_ZOOM;
|
|
|
|
|
url = "http://maps.google.com?saddr=Current+Location&daddr=" + ilat + "," + ilon;
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse("http", url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon, z));
|
|
|
|
|
|
|
|
|
|
// http://maps.google.com?saddr=Current+Location&daddr=34.99,-106.61
|
|
|
|
|
// http://maps.google.com?saddr=Current+Location&daddr=34.99393,-106.61568
|
|
|
|
|
z = GeoParsedPoint.NO_ZOOM;
|
|
|
|
|
url = "http://maps.google.com?saddr=Current+Location&daddr=" + dlat + "," + dlon;
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse("http", url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
|
|
|
|
|
|
|
|
|
|
// http://www.google.com/maps/dir/Current+Location/34,-106
|
|
|
|
|
z = GeoParsedPoint.NO_ZOOM;
|
|
|
|
|
url = "http://www.google.com/maps/dir/Current+Location/" + ilat + "," + ilon;
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse("http", url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon, z));
|
|
|
|
|
|
|
|
|
|
// http://www.google.com/maps/dir/Current+Location/34.99,-106.61
|
|
|
|
|
// http://www.google.com/maps/dir/Current+Location/34.99393,-106.61568
|
|
|
|
|
z = GeoParsedPoint.NO_ZOOM;
|
|
|
|
|
url = "http://www.google.com/maps/dir/Current+Location/" + dlat + "," + dlon;
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse("http", url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
|
|
|
|
|
|
|
|
|
|
// http://maps.google.com/maps?q=34,-106
|
|
|
|
|
z = GeoParsedPoint.NO_ZOOM;
|
|
|
|
|
url = "http://maps.google.com/maps?q=" + ilat + "," + ilon;
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse("http", url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon, z));
|
|
|
|
|
|
|
|
|
|
// http://maps.google.com/maps?q=34.99,-106.61
|
|
|
|
|
// http://maps.google.com/maps?q=34.99393,-106.61568
|
|
|
|
|
z = GeoParsedPoint.NO_ZOOM;
|
|
|
|
|
url = "http://maps.google.com/maps?q=" + dlat + "," + dlon;
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse("http", url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
|
|
|
|
|
|
|
|
|
|
// http://www.google.com/maps/place/760+West+Genesee+Street+Syracuse+NY+13204
|
|
|
|
|
qstr = "760+West+Genesee+Street+Syracuse+NY+13204";
|
|
|
|
|
url = "http://www.google.com/maps/place/" + qstr;
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse("http", url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(qstr));
|
|
|
|
|
|
|
|
|
|
// http://maps.google.com/maps?q=760+West+Genesee+Street+Syracuse+NY+13204
|
|
|
|
|
qstr = "760+West+Genesee+Street+Syracuse+NY+13204";
|
|
|
|
|
url = "http://www.google.com/maps?q=" + qstr;
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse("http", 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=" + qstr;
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse("http", url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(qstr));
|
|
|
|
|
|
|
|
|
|
// http://www.google.com/maps/dir/Current+Location/760+West+Genesee+Street+Syracuse+NY+13204
|
|
|
|
|
qstr = "760+West+Genesee+Street+Syracuse+NY+13204";
|
|
|
|
|
url = "http://www.google.com/maps/dir/Current+Location/" + qstr;
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse("http", url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(qstr));
|
|
|
|
|
|
|
|
|
|
// http://maps.yandex.ru/?ll=34,-106&z=11
|
|
|
|
|
z = 11;
|
|
|
|
|
url = "http://maps.yandex.ru/?ll=" + ilat + "," + ilon + "&z=" + z;
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse("http", url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon, z));
|
|
|
|
|
|
|
|
|
|
// http://maps.yandex.ru/?ll=34.99,-106.61&z=11
|
|
|
|
|
// http://maps.yandex.ru/?ll=34.99393,-106.61568&z=11
|
|
|
|
|
z = 11;
|
|
|
|
|
url = "http://maps.yandex.ru/?ll=" + dlat + "," + dlon + "&z=" + z;
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse("http", url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
|
|
|
|
|
|
|
|
|
|
// http://map.baidu.com/?l=13&tn=B_NORMAL_MAP&c=13748138,4889173&s=gibberish
|
|
|
|
|
z = 7;
|
|
|
|
|
int latint = ((int)(dlat * 100000));
|
|
|
|
|
int lonint = ((int)(dlon * 100000));
|
|
|
|
|
url = "http://map.baidu.com/?l=" + z + "&tn=B_NORMAL_MAP&c=" + latint + "," + lonint + "&s=gibberish";
|
|
|
|
|
System.out.println("url: " + url);
|
|
|
|
|
actual = GeoPointParserUtil.parse(url);
|
|
|
|
|
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
|
|
|
|
|
|
|
|
|
|
/* URLs straight from various services, instead of generated here */
|
|
|
|
|
|
|
|
|
|
String urls[] = {
|
|
|
|
|
"https://openstreetmap.org/go/0LQ127-?m",
|
|
|
|
|
"http://osm.org/go/0LQ127-?m",
|
|
|
|
|
"http://osm.org/go/0EEQjE==",
|
|
|
|
|
"http://osm.org/go/0EEQjEEb",
|
|
|
|
|
"http://osm.org/go/0EE~jEEb",
|
|
|
|
|
"http://osm.org/go/0EE@jEEb",
|
|
|
|
|
"http://osm.org/go/~~~~",
|
|
|
|
|
"http://osm.org/go/@@@@",
|
|
|
|
|
"https://www.openstreetmap.org/#map=0/0/0",
|
|
|
|
|
"https://www.openstreetmap.org/#map=0/180/180",
|
|
|
|
|
"https://www.openstreetmap.org/#map=0/-180/-180",
|
|
|
|
|
"https://www.openstreetmap.org/#map=0/180.0/180.0",
|
|
|
|
|
"https://www.openstreetmap.org/#map=6/33.907/34.662",
|
|
|
|
|
"https://www.openstreetmap.org/?mlat=49.56275939941406&mlon=17.291107177734375#map=8/49.563/17.291",
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
for (String u : urls) {
|
|
|
|
|
System.out.println("url: " + u);
|
|
|
|
|
actual = GeoPointParserUtil.parse(u);
|
|
|
|
|
assert(actual != null);
|
|
|
|
|
System.out.println("Passed!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static boolean areCloseEnough(int a, int b) {
|
|
|
|
|
return a == b;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static boolean areCloseEnough(double a, double b, long howClose) {
|
|
|
|
|
long aRounded = (long) Math.round(a * Math.pow(10, howClose));
|
|
|
|
|
long bRounded = (long) Math.round(b * Math.pow(10, howClose));
|
|
|
|
|
System.out.println("areCloseEnough: " + aRounded + ", " + bRounded);
|
|
|
|
|
return aRounded == bRounded;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void assertGeoPoint(GeoParsedPoint actual, GeoParsedPoint expected) {
|
|
|
|
@ -304,7 +407,7 @@ public class GeoPointParserUtil {
|
|
|
|
|
if (!expected.getQuery().equals(actual.getQuery()))
|
|
|
|
|
throw new RuntimeException("Query param not equal");
|
|
|
|
|
} else {
|
|
|
|
|
double aLat = actual.getLat(), eLat = expected.getLat(), aLon = actual.getLon(), eLon = expected.getLon();
|
|
|
|
|
double aLat = actual.getLatitude(), eLat = expected.getLatitude(), aLon = actual.getLongitude(), eLon = expected.getLongitude();
|
|
|
|
|
int aZoom = actual.getZoom(), eZoom = expected.getZoom();
|
|
|
|
|
String aName = actual.getName(), eName = expected.getName();
|
|
|
|
|
if (eName != null) {
|
|
|
|
@ -313,10 +416,10 @@ public class GeoPointParserUtil {
|
|
|
|
|
+ eName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (eLat != aLat) {
|
|
|
|
|
if (!areCloseEnough(eLat, aLat, 5)) {
|
|
|
|
|
throw new RuntimeException("Latitude is not equal; actual=" + aLat + ", expected=" + eLat);
|
|
|
|
|
}
|
|
|
|
|
if (eLon != aLon) {
|
|
|
|
|
if (!areCloseEnough(eLon, aLon, 5)) {
|
|
|
|
|
throw new RuntimeException("Longitude is not equal; actual=" + aLon + ", expected=" + eLon);
|
|
|
|
|
}
|
|
|
|
|
if (eZoom != aZoom) {
|
|
|
|
@ -326,8 +429,35 @@ public class GeoPointParserUtil {
|
|
|
|
|
System.out.println("Passed!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static String getQueryParameter(final String param, URI data) {
|
|
|
|
|
final String query = data.getQuery();
|
|
|
|
|
private static void assertApproximateGeoPoint(GeoParsedPoint actual, GeoParsedPoint expected) {
|
|
|
|
|
if (expected.getQuery() != null) {
|
|
|
|
|
if (!expected.getQuery().equals(actual.getQuery()))
|
|
|
|
|
throw new RuntimeException("Query param not equal");
|
|
|
|
|
} else {
|
|
|
|
|
double aLat = actual.getLatitude(), eLat = expected.getLatitude(), aLon = actual.getLongitude(), eLon = expected.getLongitude();
|
|
|
|
|
int aZoom = actual.getZoom(), eZoom = expected.getZoom();
|
|
|
|
|
String aName = actual.getName(), eName = expected.getName();
|
|
|
|
|
if (eName != null) {
|
|
|
|
|
if (!aName.equals(eName)) {
|
|
|
|
|
throw new RuntimeException("Point name\\capture is not equal; actual=" + aName + ", expected="
|
|
|
|
|
+ eName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (((int)eLat) != ((int)aLat)) {
|
|
|
|
|
throw new RuntimeException("Latitude is not equal; actual=" + aLat + ", expected=" + eLat);
|
|
|
|
|
}
|
|
|
|
|
if (((int)eLon) != ((int)aLon)) {
|
|
|
|
|
throw new RuntimeException("Longitude is not equal; actual=" + aLon + ", expected=" + eLon);
|
|
|
|
|
}
|
|
|
|
|
if (eZoom != aZoom) {
|
|
|
|
|
throw new RuntimeException("Zoom is not equal; actual=" + aZoom + ", expected=" + eZoom);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
System.out.println("Passed!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static String getQueryParameter(final String param, URI uri) {
|
|
|
|
|
final String query = uri.getQuery();
|
|
|
|
|
String value = null;
|
|
|
|
|
if (query != null && query.contains(param)) {
|
|
|
|
|
String[] params = query.split("&");
|
|
|
|
@ -344,30 +474,34 @@ public class GeoPointParserUtil {
|
|
|
|
|
/**
|
|
|
|
|
* Parses geo and map intents:
|
|
|
|
|
*
|
|
|
|
|
* @param scheme
|
|
|
|
|
* The intent scheme
|
|
|
|
|
* @param uri
|
|
|
|
|
* The URI object
|
|
|
|
|
* @return {@link GeoParsedPoint}
|
|
|
|
|
*/
|
|
|
|
|
public static GeoParsedPoint parse(final String scheme, final String uri) {
|
|
|
|
|
final URI data = URI.create(uri.replaceAll("\\s+", "+").replaceAll("%20", "+").replaceAll("%2C", ","));
|
|
|
|
|
if ("http".equals(scheme) || "https".equals(scheme)) {
|
|
|
|
|
public static GeoParsedPoint parse(final String uriString) {
|
|
|
|
|
final URI uri = URI.create(uriString.replaceAll("\\s+", "+").replaceAll("%20", "+").replaceAll("%2C", ","));
|
|
|
|
|
|
|
|
|
|
final String schemeSpecific = data.getSchemeSpecificPart();
|
|
|
|
|
|
|
|
|
|
if (schemeSpecific == null) {
|
|
|
|
|
String scheme = uri.getScheme();
|
|
|
|
|
if (scheme == null)
|
|
|
|
|
return null;
|
|
|
|
|
else
|
|
|
|
|
scheme = scheme.toLowerCase(Locale.US);
|
|
|
|
|
|
|
|
|
|
if ("http".equals(scheme) || "https".equals(scheme)) {
|
|
|
|
|
String host = uri.getHost();
|
|
|
|
|
if (host == null)
|
|
|
|
|
return null;
|
|
|
|
|
else
|
|
|
|
|
host = host.toLowerCase(Locale.US);
|
|
|
|
|
|
|
|
|
|
final String schemeSpecific = uri.getSchemeSpecificPart();
|
|
|
|
|
if (schemeSpecific == null)
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
final String[] osmandNetSite = { "//download.osmand.net/go?" };
|
|
|
|
|
|
|
|
|
|
final String[] osmandNetPattern = { "lat=([+-]?\\d+(?:\\.\\d+)?)&lon=([+-]?\\d+(?:\\.\\d+)?)&?(z=\\d{1,2})" };
|
|
|
|
|
|
|
|
|
|
final String[] openstreetmapOrgSite = { "//openstreetmap.org/", "//www.openstreetmap.org/" };
|
|
|
|
|
|
|
|
|
|
final String[] openstreetmapOrgPattern = { "(?:.*)(?:map=)(\\d{1,2})/([+-]?\\d+(?:\\.\\d+)?)/([+-]?\\d+(?:\\.\\d+)?)(?:.*)" };
|
|
|
|
|
|
|
|
|
|
final String[] openstreetmapDeSite = { "//openstreetmap.de/", "//www.openstreetmap.de/" };
|
|
|
|
|
|
|
|
|
|
final String[] openstreetmapDePattern = {
|
|
|
|
@ -390,11 +524,69 @@ public class GeoPointParserUtil {
|
|
|
|
|
|
|
|
|
|
final String[] yandexRuPattern = { "(?:.*)ll=([+-]?\\d+(?:\\.\\d+)?),([+-]?\\d+(?:\\.\\d+)?)(?:.+)(z=\\d{1,2})(?:.*)" };
|
|
|
|
|
|
|
|
|
|
final String sites[][] = { osmandNetSite, openstreetmapOrgSite, openstreetmapDeSite, googleComSite,
|
|
|
|
|
yandexRuSite };
|
|
|
|
|
final String sites[][] = { osmandNetSite, openstreetmapDeSite,
|
|
|
|
|
googleComSite, yandexRuSite };
|
|
|
|
|
|
|
|
|
|
final String patterns[][] = { osmandNetPattern,
|
|
|
|
|
openstreetmapDePattern, googleComPattern, yandexRuPattern };
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
if (host.equals("osm.org") || host.endsWith("openstreetmap.org")) {
|
|
|
|
|
Pattern p;
|
|
|
|
|
Matcher matcher;
|
|
|
|
|
String path = uri.getPath();
|
|
|
|
|
if (path != null && path.startsWith("/go/")) { // short URL form
|
|
|
|
|
p = Pattern.compile("^/go/([A-Za-z0-9_@~]+-*)(?:.*)");
|
|
|
|
|
matcher = p.matcher(uri.getPath());
|
|
|
|
|
if (matcher.matches()) {
|
|
|
|
|
return MapUtils.decodeShortLinkString(matcher.group(1));
|
|
|
|
|
}
|
|
|
|
|
} else { // data in the query and/or feature strings
|
|
|
|
|
String lat = "0";
|
|
|
|
|
String lon = "0";
|
|
|
|
|
String zoom = String.valueOf(GeoParsedPoint.NO_ZOOM);
|
|
|
|
|
String fragment = uri.getFragment();
|
|
|
|
|
if (fragment != null) {
|
|
|
|
|
p = Pattern.compile("(?:map=)?(\\d{1,2})/([+-]?\\d+(?:\\.\\d+)?)/([+-]?\\d+(?:\\.\\d+)?)(?:.*)");
|
|
|
|
|
matcher = p.matcher(fragment);
|
|
|
|
|
if (matcher.matches()) {
|
|
|
|
|
zoom = matcher.group(1);
|
|
|
|
|
lat = matcher.group(2);
|
|
|
|
|
lon = matcher.group(3);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
String query = uri.getQuery();
|
|
|
|
|
if (query != null) {
|
|
|
|
|
// the query string sometimes has higher resolution values
|
|
|
|
|
p = Pattern.compile("(?:.*)mlat=([+-]?\\d+(?:\\.\\d+)?)(?:.*)&mlon=([+-]?\\d+(?:\\.\\d+)?)(?:.*)?");
|
|
|
|
|
matcher = p.matcher(query);
|
|
|
|
|
if (matcher.matches()) {
|
|
|
|
|
lat = matcher.group(1);
|
|
|
|
|
lon = matcher.group(2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return new GeoParsedPoint(lat, lon, zoom);
|
|
|
|
|
}
|
|
|
|
|
} else if (schemeSpecific.startsWith("//map.baidu.")) { // .com and .cn both work
|
|
|
|
|
/* Baidu Map uses a custom format for lat/lon., it is basically standard lat/lon
|
|
|
|
|
* multiplied by 100,000, then rounded to an integer */
|
|
|
|
|
Pattern p = Pattern.compile(".*[/?&]l=(\\d{1,2}).*&c=([+-]?\\d+),([+-]?\\d+).*");
|
|
|
|
|
Matcher matcher = p.matcher(schemeSpecific);
|
|
|
|
|
if (matcher.matches()) {
|
|
|
|
|
double lat = Integer.valueOf(matcher.group(2)) / 100000.;
|
|
|
|
|
double lon = Integer.valueOf(matcher.group(3)) / 100000.;
|
|
|
|
|
int zoom = parseZoom(matcher.group(1));
|
|
|
|
|
return new GeoParsedPoint(lat, lon, zoom);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (IllegalStateException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
return null;
|
|
|
|
|
} catch (NumberFormatException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
final String patterns[][] = { osmandNetPattern, openstreetmapOrgPattern, openstreetmapDePattern,
|
|
|
|
|
googleComPattern, yandexRuPattern };
|
|
|
|
|
// search by geo coordinates
|
|
|
|
|
for (int s = 0; s < sites.length; s++) {
|
|
|
|
|
for (int si = 0; si < sites[s].length; si++) {
|
|
|
|
@ -403,7 +595,7 @@ public class GeoPointParserUtil {
|
|
|
|
|
String subString = schemeSpecific.substring(sites[s][si].length());
|
|
|
|
|
|
|
|
|
|
if (subString.equals("")) {
|
|
|
|
|
subString = data.getFragment();
|
|
|
|
|
subString = uri.getFragment();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
final Matcher matcher = Pattern.compile(patterns[s][p]).matcher(subString);
|
|
|
|
@ -461,9 +653,8 @@ public class GeoPointParserUtil {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
if ("geo".equals(scheme) || "osmand.geo".equals(scheme)) {
|
|
|
|
|
String schemeSpecific = data.getSchemeSpecificPart();
|
|
|
|
|
} else if ("geo".equals(scheme) || "osmand.geo".equals(scheme)) {
|
|
|
|
|
String schemeSpecific = uri.getSchemeSpecificPart();
|
|
|
|
|
if (schemeSpecific == null) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
@ -540,6 +731,14 @@ public class GeoPointParserUtil {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static int parseZoom(String zoom) {
|
|
|
|
|
try {
|
|
|
|
|
return Integer.valueOf(zoom);
|
|
|
|
|
} catch (NumberFormatException e) {
|
|
|
|
|
return GeoParsedPoint.NO_ZOOM;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class GeoParsedPoint {
|
|
|
|
|
private static final int NO_ZOOM = -1;
|
|
|
|
|
|
|
|
|
@ -574,17 +773,27 @@ public class GeoPointParserUtil {
|
|
|
|
|
this.zoom = zoom;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public GeoParsedPoint(String latString, String lonString, String zoomString) throws NumberFormatException {
|
|
|
|
|
this(Double.valueOf(latString), Double.valueOf(lonString));
|
|
|
|
|
this.zoom = parseZoom(zoomString);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public GeoParsedPoint(String latString, String lonString) throws NumberFormatException {
|
|
|
|
|
this(Double.valueOf(latString), Double.valueOf(lonString));
|
|
|
|
|
this.zoom = NO_ZOOM;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public GeoParsedPoint(String query) {
|
|
|
|
|
super();
|
|
|
|
|
this.query = query;
|
|
|
|
|
this.geoAddress = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public double getLat() {
|
|
|
|
|
public double getLatitude() {
|
|
|
|
|
return lat;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public double getLon() {
|
|
|
|
|
public double getLongitude() {
|
|
|
|
|
return lon;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|