diff --git a/OsmAnd-java/src/main/java/net/osmand/util/MapUtils.java b/OsmAnd-java/src/main/java/net/osmand/util/MapUtils.java index d4731dcd8d..15c3364007 100644 --- a/OsmAnd-java/src/main/java/net/osmand/util/MapUtils.java +++ b/OsmAnd-java/src/main/java/net/osmand/util/MapUtils.java @@ -333,8 +333,8 @@ public class MapUtils { }); } - public static String buildGeoUrl(double latitude, double longitude, int zoom) { - return "geo:" + ((float) latitude) + "," + ((float) longitude) + "?z=" + zoom; + public static String buildGeoUrl(String latitude, String longitude, int zoom) { + return "geo:" + latitude + "," + longitude + "?z=" + zoom; } // Examples diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/ShareMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/ShareMenu.java index f688212204..53384024ff 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/ShareMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/ShareMenu.java @@ -9,6 +9,7 @@ import androidx.annotation.NonNull; import androidx.core.text.TextUtilsCompat; import androidx.core.view.ViewCompat; +import net.osmand.LocationConvert; import net.osmand.data.LatLon; import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.OsmandApplication; @@ -99,10 +100,13 @@ public class ShareMenu extends BaseMenuController { if (mapActivity == null) { return; } + String lat = LocationConvert.convertLatitude(latLon.getLatitude(), LocationConvert.FORMAT_DEGREES, false); + String lon = LocationConvert.convertLongitude(latLon.getLongitude(), LocationConvert.FORMAT_DEGREES, false); + lat = lat.substring(0, lat.length() - 1); + lon = lon.substring(0, lon.length() - 1); final int zoom = mapActivity.getMapView().getZoom(); - final String geoUrl = MapUtils.buildGeoUrl(latLon.getLatitude(), latLon.getLongitude(), zoom); - final String httpUrl = "https://osmand.net/go?lat=" + ((float) latLon.getLatitude()) - + "&lon=" + ((float) latLon.getLongitude()) + "&z=" + zoom; + final String geoUrl = MapUtils.buildGeoUrl(lat, lon, zoom); + final String httpUrl = "https://osmand.net/go?lat=" + lat + "&lon=" + lon + "&z=" + zoom; StringBuilder sb = new StringBuilder(); if (!Algorithms.isEmpty(title)) { sb.append(title).append("\n");