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