Add more place types, refactor tag usage
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user