Add OSM links for custom saved places

Link to the OSM search route, so we get a pin when opening OSM from
Marco
This commit is contained in:
2026-06-29 16:28:55 +02:00
parent 5b8bec6a00
commit 43da923af0
2 changed files with 62 additions and 3 deletions
+16 -3
View File
@@ -23,6 +23,7 @@ export default class PlaceDetails extends Component {
@service storage;
@service nostrAuth;
@service nostrData;
@service mapUi;
@tracked isEditing = false;
@tracked showLists = false;
@tracked isPhotoUploadActive = false;
@@ -345,9 +346,21 @@ export default class PlaceDetails extends Component {
get osmUrl() {
const id = this.place.osmId;
if (!id) return null;
const type = this.place.osmType || 'node';
return `https://www.openstreetmap.org/${type}/${id}`;
if (id) {
const type = this.place.osmType || 'node';
return `https://www.openstreetmap.org/${type}/${id}`;
}
const lat = this.place.lat;
const lon = this.place.lon;
if (!lat || !lon) return null;
const viewLat = this.mapUi.currentCenter?.lat ?? lat;
const viewLon = this.mapUi.currentCenter?.lon ?? lon;
const zoom = this.mapUi.currentZoom ?? 17;
const roundedZoom = Math.round(zoom);
return `https://www.openstreetmap.org/search?lat=${lat}&lon=${lon}&zoom=${roundedZoom}#map=${roundedZoom}/${Number(viewLat).toFixed(5)}/${Number(viewLon).toFixed(5)}`;
}
get gmapsUrl() {