aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2020-04-19 18:46:40 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-04-19 18:52:15 -0700
commitb0dfc0d0ffe72d188cac75561fd178fde7d875a1 (patch)
tree75322b67daa6f6bd136695d1097d61d8cf2b6646
parentad66297cfd843199f39e3a231cb8311652ea183c (diff)
downloadsubsurface-b0dfc0d0ffe72d188cac75561fd178fde7d875a1.tar.gz
maps: show the dive site when opening Google map
I'm not sure if Google used to show the POI marker at the center location in the past or if this is actually a new feature. Either way this appears to do the right thing in my testing. Note that we need a 'plus' to connect the point of interest cooridnates, but a 'comma' to connect the map center coordinates. Reported-by: Chirana Gheorghita Eugeniu Theodor <office@adaptcom.ro> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--CHANGELOG.md1
-rw-r--r--map-widget/qml/MapWidget.qml3
2 files changed, 3 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d37eb805e..fb4c4cfd1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,4 @@
+maps: show the dive site as marker when opening Google Maps
Mobile: fix false rejection of Subsurface cloud SSL certificate
Mobile: fix misdetection of Shearwater Petrel 2 on iOS
Desktop: fix creation of new cylinder types (names couldn't be the start of already existing names)
diff --git a/map-widget/qml/MapWidget.qml b/map-widget/qml/MapWidget.qml
index a71ade59c..f028bd1c3 100644
--- a/map-widget/qml/MapWidget.qml
+++ b/map-widget/qml/MapWidget.qml
@@ -344,11 +344,12 @@ Item {
*/
function openLocationInGoogleMaps(latitude, longitude) {
var loc = latitude + "," + longitude
+ var poi = latitude + "+" + longitude
var x = map.zoomLevel
var a = 53864950.831693
var b = -0.60455861606547030630
var zoom = Math.floor(a * Math.exp(b * x))
- var url = "https://www.google.com/maps/place/@" + loc + "," + zoom + "m/data=!3m1!1e3!4m2!3m1!1s0x0:0x0"
+ var url = "https://www.google.com/maps/place/" + poi + "/@" + loc + "," + zoom + "m/data=!3m1!1e3!4m2!3m1!1s0x0:0x0"
Qt.openUrlExternally(url)
console.log("openLocationInGoogleMaps() map.zoomLevel: " + x + ", url: " + url)
}