Merge pull request #10494 from osmandapp/fix_using_google_maps_links

Fix opening links to maps "geo:0,0"
This commit is contained in:
alex-osm 2021-01-10 16:26:00 +03:00 committed by GitHub
commit 46005225fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -553,11 +553,20 @@ public class GeoPointParserUtil {
} }
if (searchRequest != null) { if (searchRequest != null) {
String searchPattern = Pattern.compile("(?:\\.|,|\\s+|\\+|[+-]?\\d+(?:\\.\\d+)?)").pattern();
String[] search = searchRequest.split(searchPattern);
if (search.length > 0) {
return new GeoParsedPoint(searchRequest);
}
final Matcher positionInSearchRequestMatcher = final Matcher positionInSearchRequestMatcher =
positionPattern.matcher(searchRequest); positionPattern.matcher(searchRequest);
if (lat == 0.0 && lon == 0.0 && positionInSearchRequestMatcher.find()) { if (lat == 0.0 && lon == 0.0 && positionInSearchRequestMatcher.find()) {
lat = Double.valueOf(positionInSearchRequestMatcher.group(1)); double tempLat = Double.valueOf(positionInSearchRequestMatcher.group(1));
lon = Double.valueOf(positionInSearchRequestMatcher.group(2)); double tempLon = Double.valueOf(positionInSearchRequestMatcher.group(2));
if (tempLat >= -90 && tempLat <= 90 && tempLon >= -180 && tempLon <= 180) {
lat = tempLat;
lon = tempLon;
}
} }
} }