1
0
mirror of https://github.com/immich-app/immich.git synced 2025-07-01 05:35:03 +02:00

feat(web): add link to external map in leaflet popup (#3847)

* feat(web): add link to external map in leaflet popup

Sometimes it's useful to open a geo location to an external map
application to not have to copy the coordinates manually.
Here I put a link to OpenStreetMap because it's what I personally use.
But I known some people would want to use something different. We could
instead link to geohacks (eg. https://geohack.toolforge.org/geohack.php?params=048.861085_N_0002.313158_E_globe:Earth)
or make it a configurable param.

* chore: cleanup

---------

Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
This commit is contained in:
Le_Futuriste
2023-08-25 15:19:49 +02:00
committed by GitHub
parent 6d1567cf44
commit 20e0c03b39
2 changed files with 20 additions and 6 deletions

View File

@ -35,10 +35,13 @@
const lng = asset.exifInfo?.longitude;
if (lat && lng) {
return [lat, lng] as LatLngTuple;
return [Number(lat.toFixed(7)), Number(lng.toFixed(7))] as LatLngTuple;
}
})();
$: lat = latlng ? latlng[0] : undefined;
$: lng = latlng ? latlng[1] : undefined;
$: people = asset.people || [];
const dispatch = createEventDispatcher();
@ -259,7 +262,14 @@
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
}}
/>
<Marker {latlng} popupContent="{latlng[0].toFixed(7)},{latlng[1].toFixed(7)}" />
<Marker {latlng}>
<p>
{lat}, {lng}
</p>
<a href="https://www.openstreetmap.org/?mlat={lat}&mlon={lng}&zoom=15#map=15/{lat}/{lng}">
Open in OpenStreetMap
</a>
</Marker>
</Map>
{/await}
</div>