Draw outlines/areas for ways and relations on map

This commit is contained in:
2026-02-24 11:22:57 +04:00
parent 1926e2b20c
commit d827fe263b
5 changed files with 298 additions and 3 deletions

View File

@@ -48,7 +48,28 @@ export default class PlaceRoute extends Route {
}
}
afterModel(model) {
async afterModel(model) {
// If the model comes from a search result (e.g. Photon), it might lack detailed geometry.
// We want to ensure we have the full OSM object (with polygon/linestring) for display.
if (
model &&
model.osmId &&
model.osmType &&
model.osmType !== 'node' &&
!model.geojson
) {
// Only fetch if it's NOT a node (nodes don't have interesting geometry anyway, just a point)
// Although fetching nodes again ensures we have the latest tags too.
console.debug('Model missing geometry, fetching full OSM details...');
const fullDetails = await this.loadOsmPlace(model.osmId, model.osmType);
if (fullDetails) {
// Update the model in-place with the fuller details
Object.assign(model, fullDetails);
console.debug('Enriched model with full OSM details', model);
}
}
// Notify the Map UI to show the pin
if (model) {
this.mapUi.selectPlace(model);