Add more place types, refactor tag usage

This commit is contained in:
2026-02-23 17:53:46 +04:00
parent ecb3fe4b5a
commit 323aab8256
6 changed files with 113 additions and 42 deletions

View File

@@ -1,3 +1,5 @@
import { humanizeOsmTag } from './format-text';
export function getLocalizedName(tags, defaultName = 'Untitled Place') {
if (!tags) return defaultName;
@@ -30,3 +32,22 @@ export function getLocalizedName(tags, defaultName = 'Untitled Place') {
// 5. Final fallback
return defaultName;
}
export function getPlaceType(tags) {
if (!tags) return null;
const rawType =
tags.amenity ||
tags.shop ||
tags.tourism ||
tags.leisure ||
tags.office ||
tags.craft ||
tags.historic ||
tags.place ||
tags.building ||
tags.landuse ||
tags.natural;
return humanizeOsmTag(rawType);
}