Handle and store OSM type and tags properly
This commit is contained in:
parent
2122d580de
commit
598ac5e587
@ -103,12 +103,14 @@ export default class PlacesSidebar extends Component {
|
||||
} else {
|
||||
// It's a fresh POI -> Save it
|
||||
const placeData = {
|
||||
title: place.tags.name || place.tags['name:en'] || 'Untitled Place',
|
||||
title: place.osmTags.name || place.osmTags['name:en'] || 'Untitled Place',
|
||||
lat: place.lat,
|
||||
lon: place.lon,
|
||||
tags: [],
|
||||
url: place.tags.website,
|
||||
url: place.osmTags.website,
|
||||
osmId: String(place.osmId || place.id), // Ensure we grab osmId if available, or fallback to id
|
||||
osmType: place.osmType,
|
||||
osmTags: place.osmTags,
|
||||
};
|
||||
|
||||
try {
|
||||
@ -161,33 +163,33 @@ export default class PlacesSidebar extends Component {
|
||||
<div class="place-details">
|
||||
<h3>{{or
|
||||
@selectedPlace.title
|
||||
@selectedPlace.tags.name
|
||||
@selectedPlace.tags.name:en
|
||||
@selectedPlace.osmTags.name
|
||||
@selectedPlace.osmTags.name:en
|
||||
"Unnamed Place"
|
||||
}}</h3>
|
||||
<p class="place-meta">
|
||||
{{#if @selectedPlace.tags.amenity}}
|
||||
{{or
|
||||
@selectedPlace.tags.amenity
|
||||
@selectedPlace.tags.shop
|
||||
@selectedPlace.tags.tourism
|
||||
}}
|
||||
{{else}}
|
||||
{{or
|
||||
@selectedPlace.osmTags.amenity
|
||||
@selectedPlace.osmTags.shop
|
||||
@selectedPlace.osmTags.tourism
|
||||
"Point of Interest"
|
||||
}}
|
||||
{{#if @selectedPlace.description}}
|
||||
{{@selectedPlace.description}}
|
||||
{{/if}}
|
||||
</p>
|
||||
|
||||
{{#if (or @selectedPlace.url @selectedPlace.tags.website)}}
|
||||
{{#if (or @selectedPlace.url @selectedPlace.osmTags.website)}}
|
||||
<p><a
|
||||
href={{or @selectedPlace.url @selectedPlace.tags.website}}
|
||||
href={{or @selectedPlace.url @selectedPlace.osmTags.website}}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>Website</a></p>
|
||||
{{/if}}
|
||||
|
||||
{{#if @selectedPlace.tags.opening_hours}}
|
||||
{{#if @selectedPlace.osmTags.opening_hours}}
|
||||
<p><strong>Open:</strong>
|
||||
{{@selectedPlace.tags.opening_hours}}</p>
|
||||
{{@selectedPlace.osmTags.opening_hours}}</p>
|
||||
{{/if}}
|
||||
|
||||
<div class="actions">
|
||||
@ -215,9 +217,9 @@ export default class PlacesSidebar extends Component {
|
||||
<p><small>OSM ID:
|
||||
<a
|
||||
href="https://www.openstreetmap.org/{{if
|
||||
@selectedPlace.type
|
||||
@selectedPlace.type
|
||||
'node'
|
||||
@selectedPlace.osmType
|
||||
@selectedPlace.osmType
|
||||
(if @selectedPlace.osmType @selectedPlace.osmType 'node')
|
||||
}}/{{or @selectedPlace.osmId @selectedPlace.id}}"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
|
||||
@ -34,9 +34,10 @@ export default class PlaceRoute extends Route {
|
||||
title: poi.tags.name || poi.tags['name:en'] || 'Untitled Place',
|
||||
lat: poi.lat || poi.center?.lat,
|
||||
lon: poi.lon || poi.center?.lon,
|
||||
tags: poi.tags, // raw tags
|
||||
url: poi.tags.website,
|
||||
osmId: String(poi.id),
|
||||
osmTags: poi.tags, // raw tags
|
||||
osmType: poi.type, // "node" or "way"
|
||||
description: poi.tags.description, // ensure description maps
|
||||
// No ID/Geohash/CreatedAt means it's not saved
|
||||
};
|
||||
|
||||
@ -14,11 +14,11 @@ export default class OsmService extends Service {
|
||||
const query = `
|
||||
[out:json][timeout:25];
|
||||
(
|
||||
nwr["amenity"](around:${radius},${lat},${lon});
|
||||
nwr["shop"](around:${radius},${lat},${lon});
|
||||
nwr["tourism"](around:${radius},${lat},${lon});
|
||||
nwr["leisure"](around:${radius},${lat},${lon});
|
||||
nwr["historic"](around:${radius},${lat},${lon});
|
||||
nw["amenity"](around:${radius},${lat},${lon});
|
||||
nw["shop"](around:${radius},${lat},${lon});
|
||||
nw["tourism"](around:${radius},${lat},${lon});
|
||||
nw["leisure"](around:${radius},${lat},${lon});
|
||||
nw["historic"](around:${radius},${lat},${lon});
|
||||
);
|
||||
out center;
|
||||
`.trim();
|
||||
@ -77,7 +77,6 @@ out center;
|
||||
(
|
||||
node(${id});
|
||||
way(${id});
|
||||
relation(${id});
|
||||
);
|
||||
out center;
|
||||
`.trim();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user