Merge pull request #873 from rilaby/geopatterns

changed the patterns to stick to one for lat, lon;
This commit is contained in:
vshcherb 2014-09-10 14:15:10 +02:00
commit bfe1f02255

View file

@ -7,71 +7,71 @@ import java.util.regex.Pattern;
public class GeoPointParserUtil {
public static void main(String[] args) {
final double lat = 34.99, lon = -106.61;
final int ilat = 34, ilon = -106;
final double dlat = 34.99, dlon = -106.61;
final String name = "Treasure Island";
int z = GeoParsedPoint.NO_ZOOM;
String url;
// geo:34.99,-106.61
url = "geo:" + lat + "," + lon;
// geo:34,-106
url = "geo:" + ilat + "," + ilon;
System.out.println("url: " + url);
GeoParsedPoint actual = GeoPointParserUtil.parse("geo", url);
assertGeoPoint(actual, new GeoParsedPoint(lat, lon));
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon));
// geo:34.99,-106.61
url = "geo:" + dlat + "," + dlon;
System.out.println("url: " + url);
actual = GeoPointParserUtil.parse("geo", url);
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon));
// geo:34.99,-106.61?z=11
z = 11;
url = "geo:" + lat + "," + lon + "?z=" + z;
url = "geo:" + dlat + "," + dlon + "?z=" + z;
System.out.println("url: " + url);
actual = GeoPointParserUtil.parse("geo", url);
assertGeoPoint(actual, new GeoParsedPoint(lat, lon, z));
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
// geo:34.99,-106.61 (Treasure Island)
url = "geo:" + lat + "," + lon + " (" + name + ")";
url = "geo:" + dlat + "," + dlon + " (" + name + ")";
System.out.println("url: " + url);
actual = GeoPointParserUtil.parse("geo", url);
assertGeoPoint(actual, new GeoParsedPoint(lat, lon, name));
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, name));
// geo:34.99,-106.61?z=11 (Treasure Island)
z = 11;
url = "geo:" + lat + "," + lon + "?z=" + z + " (" + name + ")";
url = "geo:" + dlat + "," + dlon + "?z=" + z + " (" + name + ")";
System.out.println("url: " + url);
actual = GeoPointParserUtil.parse("geo", url);
assertGeoPoint(actual, new GeoParsedPoint(lat, lon, z, name));
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);
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon, z, name));
// 0,0?q=34.99,-106.61(Treasure Island)
z = GeoParsedPoint.NO_ZOOM;
url = "geo:0,0?q=" + lat + "," + lon + " (" + name + ")";
url = "geo:0,0?q=" + dlat + "," + dlon + " (" + name + ")";
System.out.println("url: " + url);
actual = GeoPointParserUtil.parse("geo", url);
assertGeoPoint(actual, new GeoParsedPoint(lat, lon, z, name));
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z, name));
// geo:0,0?z=11&q=34.99,-106.61(Treasure Island)
z = 11;
url = "geo:0,0?z=" + z + "&q=" + lat + "," + lon + " (" + name + ")";
url = "geo:0,0?z=" + z + "&q=" + dlat + "," + dlon + " (" + name + ")";
System.out.println("url: " + url);
actual = GeoPointParserUtil.parse("geo", url);
assertGeoPoint(actual, new GeoParsedPoint(lat, lon, z, name));
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z, name));
// geo:0,0?z=11&q=34.99,-106.61
z = 11;
url = "geo:0,0?z=" + z + "&q=" + lat + "," + lon;
url = "geo:0,0?z=" + z + "&q=" + dlat + "," + dlon;
System.out.println("url: " + url);
actual = GeoPointParserUtil.parse("geo", url);
assertGeoPoint(actual, new GeoParsedPoint(lat, lon, z));
// geo:34.99,-106.61
z = -1;
url = "geo:" + lat + "," + lon;
System.out.println("url: " + url);
actual = GeoPointParserUtil.parse("geo", url);
assertGeoPoint(actual, new GeoParsedPoint(lat, lon, z));
// geo:34.99,-106.61?z=11
z = 11;
url = "geo:" + lat + "," + lon + "?" + "z=" + z;
System.out.println("url: " + url);
actual = GeoPointParserUtil.parse("geo", url);
assertGeoPoint(actual, new GeoParsedPoint(lat, lon, z));
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
// google calendar
// geo:0,0?q=760 West Genesee Street Syracuse NY 13204
@ -88,82 +88,153 @@ public class GeoPointParserUtil {
actual = GeoPointParserUtil.parse("geo", url);
assertGeoPoint(actual, new GeoParsedPoint(qstr));
// http://download.osmand.net/go?lat=34.99&lon=-106.61&z=11
url = "http://download.osmand.net/go?lat=" + lat + "&lon=" + lon + "&z=" + z;
// 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);
assertGeoPoint(actual, new GeoParsedPoint(lat, lon, z));
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon, z));
// http://download.osmand.net/go?lat=34.99&lon=-106.61&z=11
url = "http://download.osmand.net/go?lat=" + dlat + "&lon=" + dlon + "&z=" + z;
System.out.println("url: " + url);
actual = GeoPointParserUtil.parse("http", url);
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
// http://openstreetmap.org/map=11/34/-106
url = "http://openstreetmap.org/map=" + z + "/" + ilat + "/" + ilon;
System.out.println("url: " + url);
actual = GeoPointParserUtil.parse("http", url);
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon, z));
// http://openstreetmap.org/map=11/34.99/-106.61
url = "http://openstreetmap.org/map=" + z + "/" + lat + "/" + lon;
url = "http://openstreetmap.org/map=" + z + "/" + dlat + "/" + dlon;
System.out.println("url: " + url);
actual = GeoPointParserUtil.parse("http", url);
assertGeoPoint(actual, new GeoParsedPoint(lat, lon, z));
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
// http://openstreetmap.de/zoom=11&lat=34&lon=-106
url = "http://openstreetmap.de/zoom=" + z + "&lat=" + ilat + "&lon=" + ilon;
System.out.println("url: " + url);
actual = GeoPointParserUtil.parse("http", url);
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon, z));
// http://openstreetmap.de/zoom=11&lat=34.99&lon=-106.61
url = "http://openstreetmap.de/zoom=" + z + "&lat=" + lat + "&lon=" + lon;
url = "http://openstreetmap.de/zoom=" + z + "&lat=" + dlat + "&lon=" + dlon;
System.out.println("url: " + url);
actual = GeoPointParserUtil.parse("http", url);
assertGeoPoint(actual, new GeoParsedPoint(lat, lon, z));
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
// http://openstreetmap.de/lat=34.99&lon=-106.61&zoom=11
url = "http://openstreetmap.de/lat=" + lat + "&lon=" + lon + "&zoom=" + z;
url = "http://openstreetmap.de/lat=" + dlat + "&lon=" + dlon + "&zoom=" + z;
System.out.println("url: " + url);
actual = GeoPointParserUtil.parse("http", url);
assertGeoPoint(actual, new GeoParsedPoint(lat, lon, z));
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);
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon, z));
// http://maps.google.com/maps/@34.99,-106.61,11z
url = "http://maps.google.com/maps/@" + lat + "," + lon + "," + z + "z";
url = "http://maps.google.com/maps/@" + dlat + "," + dlon + "," + z + "z";
System.out.println("url: " + url);
actual = GeoPointParserUtil.parse("http", url);
assertGeoPoint(actual, new GeoParsedPoint(lat, lon, z));
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);
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon, z));
// http://maps.google.com/maps/ll=34.99,-106.61,z=11
url = "http://maps.google.com/maps/ll=" + lat + "," + lon + ",z=" + z;
url = "http://maps.google.com/maps/ll=" + dlat + "," + dlon + ",z=" + z;
System.out.println("url: " + url);
actual = GeoPointParserUtil.parse("http", url);
assertGeoPoint(actual, new GeoParsedPoint(lat, lon, z));
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);
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon, z));
// http://maps.google.com/maps/q=loc:34.99,-106.61&z=11
url = "http://maps.google.com/maps/q=loc:" + lat + "," + lon + "&z=" + z;
url = "http://maps.google.com/maps/q=loc:" + dlat + "," + dlon + "&z=" + z;
System.out.println("url: " + url);
actual = GeoPointParserUtil.parse("http", url);
assertGeoPoint(actual, new GeoParsedPoint(lat, lon, z));
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
// whatsapp
// http://maps.google.com/maps/q=loc:34,-106 (You)
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);
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon, z));
// whatsapp
// http://maps.google.com/maps/q=loc:34.99,-106.61 (You)
z = GeoParsedPoint.NO_ZOOM;
url = "http://maps.google.com/maps/q=loc:" + lat + "," + lon + " (You)";
url = "http://maps.google.com/maps/q=loc:" + dlat + "," + dlon + " (You)";
System.out.println("url: " + url);
actual = GeoPointParserUtil.parse("http", url);
assertGeoPoint(actual, new GeoParsedPoint(lat, lon, z));
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);
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon, z));
// http://www.google.com/maps/search/food/34.99,-106.61,14z
url = "http://www.google.com/maps/search/food/" + lat + "," + lon + "," + z + "z";
url = "http://www.google.com/maps/search/food/" + dlat + "," + dlon + "," + z + "z";
System.out.println("url: " + url);
actual = GeoPointParserUtil.parse("http", url);
assertGeoPoint(actual, new GeoParsedPoint(lat, lon, z));
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);
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon, z));
// http://maps.google.com?saddr=Current+Location&daddr=34.99,-106.61
z = GeoParsedPoint.NO_ZOOM;
url = "http://maps.google.com?saddr=Current+Location&daddr=" + lat + "," + lon;
url = "http://maps.google.com?saddr=Current+Location&daddr=" + dlat + "," + dlon;
System.out.println("url: " + url);
actual = GeoPointParserUtil.parse("http", url);
assertGeoPoint(actual, new GeoParsedPoint(lat, lon, z));
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);
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon, z));
// http://www.google.com/maps/dir/Current+Location/34.99,-106.61
z = GeoParsedPoint.NO_ZOOM;
url = "http://www.google.com/maps/dir/Current+Location/" + lat + "," + lon;
url = "http://www.google.com/maps/dir/Current+Location/" + dlat + "," + dlon;
System.out.println("url: " + url);
actual = GeoPointParserUtil.parse("http", url);
assertGeoPoint(actual, new GeoParsedPoint(lat, lon, z));
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);
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon, z));
// http://maps.google.com/maps?q=34.99,-106.61
z = GeoParsedPoint.NO_ZOOM;
url = "http://maps.google.com/maps?q=" + lat + "," + lon;
url = "http://maps.google.com/maps?q=" + dlat + "," + dlon;
System.out.println("url: " + url);
actual = GeoPointParserUtil.parse("http", url);
assertGeoPoint(actual, new GeoParsedPoint(lat, lon, z));
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";
@ -193,13 +264,19 @@ public class GeoPointParserUtil {
actual = GeoPointParserUtil.parse("http", url);
assertGeoPoint(actual, new GeoParsedPoint(qstr));
// http://maps.yandex.ru/?ll=34.99,-106.61&z=11
// http://maps.yandex.ru/?ll=34,-106&z=11
z = 11;
url = "http://maps.yandex.ru/?ll=" + lat + "," + lon + "&z=" + z;
url = "http://maps.yandex.ru/?ll=" + ilat + "," + ilon + "&z=" + z;
System.out.println("url: " + url);
actual = GeoPointParserUtil.parse("http", url);
assertGeoPoint(actual, new GeoParsedPoint(lat, lon, z));
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon, z));
// http://maps.yandex.ru/?ll=34.99,-106.61&z=11
z = 11;
url = "http://maps.yandex.ru/?ll=" + dlat + "," + dlon + "&z=" + z;
System.out.println("url: " + url);
actual = GeoPointParserUtil.parse("http", url);
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
}
private static void assertGeoPoint(GeoParsedPoint actual, GeoParsedPoint expected) {
@ -265,32 +342,33 @@ public class GeoPointParserUtil {
final String[] osmandNetSite = { "//download.osmand.net/go?" };
final String[] osmandNetPattern = { "lat=(-?\\d{1,3}\\.\\d+)&lon=(-?\\d{1,3}\\.\\d+)&z=(\\d{1,2})" };
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{1,3}\\.\\d+)/(-?\\d{1,3}\\.\\d+)(?:.*)" };
final String[] openstreetmapOrgPattern = { "(?:.*)(?:map=)(\\d{1,2})/([+-]?\\d+(?:\\.\\d+)?)/([+-]?\\d+(?:\\.\\d+)?)(?:.*)" };
final String[] openstreetmapDeSite = { "//openstreetmap.de/", "//www.openstreetmap.de/" };
final String[] openstreetmapDePattern = {
"(?:.*)zoom=(\\d{1,2})&lat=(-?\\d{1,3}\\.\\d+)&lon=(-?\\d{1,3}\\.\\d+)(?:.*)",
"(?:.*)lat=(-?\\d{1,3}\\.\\d+)&lon=(-?\\d{1,3}\\.\\d+)&z(?:oom)?=(\\d{1,2})(?:.*)" };
"(?:.*)zoom=(\\d{1,2})&lat=([+-]?\\d+(?:\\.\\d+)?)&lon=([+-]?\\d+(?:\\.\\d+)?)(?:.*)",
"(?:.*)lat=([+-]?\\d+(?:\\.\\d+)?)&lon=([+-]?\\d+(?:\\.\\d+)?)&?(z(?:oom)?=\\d{1,2})(?:.*)" };
final String[] googleComSite = { "//www.google.com/maps/", "//maps.google.com/maps", "//maps.google.com" };
final String[] googleComPattern = { "(?:.*)[@/](-?\\d{1,3}\\.\\d+),(-?\\d{1,3}\\.\\d+),(\\d{1,2})z(?:.*)",
"(?:.*)ll=(-?\\d{1,3}\\.\\d+),(-?\\d{1,3}\\.\\d+)(?:.+)z=(\\d{1,2})(?:.*)",
"(?:.*)q=([\\-+]?\\d{1,3}\\.\\d+),([\\-+]?\\d{1,3}\\.\\d+)(?:.*)&z=(\\d{1,2})",
"(?:.*)(q=)(-?\\d{1,3}\\.\\d+),(-?\\d{1,3}\\.\\d+)(?:.*)",
"(?:.*)q=loc:(-?\\d{1,3}\\.\\d+),(-?\\d{1,3}\\.\\d+)&z=(\\d{1,2})(?:.*)",
"(?:.*)(q=loc:)(-?\\d{1,3}\\.\\d+),(-?\\d{1,3}\\.\\d+)(?:.*)",
"(.*)daddr=(-?\\d{1,3}\\.\\d+),(-?\\d{1,3}\\.\\d+)(?:.*)",
"(.*)/(-?\\d{1,3}\\.\\d+),(-?\\d{1,3}\\.\\d+)(?:.*)" };
final String[] googleComPattern = {
"(?:.*)[@/]([+-]?\\d+(?:\\.\\d+)?),([+-]?\\d+(?:\\.\\d+)?),(\\d{1,2}z)(?:.*)",
"(?:.*)ll=([+-]?\\d+(?:\\.\\d+)?),([+-]?\\d+(?:\\.\\d+)?)(?:.+)(z=\\d{1,2})(?:.*)",
"(?:.*)q=([+-]?\\d+(?:\\.\\d+)?),([+-]?\\d+(?:\\.\\d+)?)(?:.*)&?(z=\\d{1,2})",
"(?:.*)(q=)([+-]?\\d+(?:\\.\\d+)?),([+-]?\\d+(?:\\.\\d+)?)(?:.*)",
"(?:.*)q=loc:([+-]?\\d+(?:\\.\\d+)?),([+-]?\\d+(?:\\.\\d+)?)&?(z=\\d{1,2})(?:.*)",
"(?:.*)(q=loc:)([+-]?\\d+(?:\\.\\d+)?),([+-]?\\d+(?:\\.\\d+)?)(?:.*)",
"(.*)daddr=([+-]?\\d+(?:\\.\\d+)?),([+-]?\\d+(?:\\.\\d+)?)(?:.*)",
"(.*)/([+-]?\\d+(?:\\.\\d+)?),([+-]?\\d+(?:\\.\\d+)?)(?:.*)" };
final String[] yandexRuSite = { "//maps.yandex.ru/" };
final String[] yandexRuPattern = { "(?:.*)ll=(-?\\d{1,3}.\\d+),(-?\\d{1,3}.\\d+)(?:.+)z=(\\d{1,2})(?:.*)" };
final String[] yandexRuPattern = { "(?:.*)ll=([+-]?\\d+(?:\\.\\d+)?),([+-]?\\d+(?:\\.\\d+)?)(?:.+)(z=\\d{1,2})(?:.*)" };
final String sites[][] = { osmandNetSite, openstreetmapOrgSite, openstreetmapDeSite, googleComSite,
yandexRuSite };
@ -318,10 +396,19 @@ public class GeoPointParserUtil {
int zoom;
// check sequence of values
if (!matcher.group(3).contains(".")) {
if (matcher.group(3).contains("z=")) {
lat = Double.valueOf(matcher.group(1));
lon = Double.valueOf(matcher.group(2));
zoom = Integer.valueOf(matcher.group(3));
zoom = Integer.valueOf(matcher.group(3).substring("z=".length()));
} else if (matcher.group(3).contains("zoom=")) {
lat = Double.valueOf(matcher.group(1));
lon = Double.valueOf(matcher.group(2));
zoom = Integer.valueOf(matcher.group(3).substring("zoom=".length()));
} else if (matcher.group(3).contains("z")) {
lat = Double.valueOf(matcher.group(1));
lon = Double.valueOf(matcher.group(2));
zoom = Integer.valueOf(matcher.group(3).substring(0,
matcher.group(3).length() - 1));
} else {
lat = Double.valueOf(matcher.group(2));
lon = Double.valueOf(matcher.group(3));
@ -364,7 +451,7 @@ public class GeoPointParserUtil {
// geo:0,0?q=34.99,-106.61(Treasure Island)
// geo:0,0?z=11&q=34.99,-106.61(Treasure Island)
String query = schemeSpecific.substring("0,0?".length());
final String pattern = "(?:z=([0-9]{1,2}))?&?q=([\\-0-9\\.]+)?,([\\-0-9\\.]+)?[\\+]*(?:\\((.+?)\\))?";
final String pattern = "(?:z=(\\d{1,2}))?&?q=([+-]?\\d+(?:\\.\\d+)?),([+-]?\\d+(?:\\.\\d+)?)[\\+]?(?:\\((.+?)\\))?";
final Matcher matcher = Pattern.compile(pattern).matcher(query);
if (matcher.matches()) {
final String z = matcher.group(1);
@ -382,7 +469,7 @@ public class GeoPointParserUtil {
} else {
// geo:47.6,-122.3
// geo:47.6,-122.3?z=11 (Treasure Island)
final String pattern = "([\\-\\d{1,2}\\.\\d]+),([\\-\\d{1,3}\\.\\d]+)(?:\\?z=(\\d{1,2}))?[\\+]?(?:\\((.*?)\\))?";
final String pattern = "([+-]?\\d+(?:\\.\\d+)?),([+-]?\\d+(?:\\.\\d+)?)(?:\\?z=(\\d{1,2}))?[\\+]?(?:\\((.*?)\\))?";
final Matcher matcher = Pattern.compile(pattern).matcher(schemeSpecific);
if (matcher.matches()) {
final double lat = Double.valueOf(matcher.group(1));