fix(place): handle boundary/administrative for wiki lookup

Add place/linked_place to extratags so wiki enrichment can detect
actual place type (e.g. boundary:administrative with place=city
should match wiki_places osm_key=place, osm_value=city).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Matt 2026-04-29 17:21:38 +00:00
commit c92178d90f

View file

@ -364,6 +364,15 @@ def _enrich_with_wiki_index(result):
state = address.get('state', '') state = address.get('state', '')
country_code = address.get('country_code', '') country_code = address.get('country_code', '')
# Handle boundary/administrative - get actual place type from extratags
# (e.g. boundary:administrative with extratags.place='city' -> place:city)
extratags = result.get('extratags', {})
if osm_class == 'boundary' and osm_type_tag == 'administrative':
place_tag = extratags.get('place') or extratags.get('linked_place')
if place_tag:
osm_class = 'place'
osm_type_tag = place_tag
if not name or not osm_class or not osm_type_tag: if not name or not osm_class or not osm_type_tag:
return result return result
@ -503,6 +512,8 @@ def _parse_nominatim(data):
'wheelchair': raw_extra.get('wheelchair'), 'wheelchair': raw_extra.get('wheelchair'),
'fee': raw_extra.get('fee'), 'fee': raw_extra.get('fee'),
'takeaway': raw_extra.get('takeaway'), 'takeaway': raw_extra.get('takeaway'),
'place': raw_extra.get('place'),
'linked_place': raw_extra.get('linked_place'),
} }
# Category: use extratags.place for boundaries (e.g. "city"), else class/type # Category: use extratags.place for boundaries (e.g. "city"), else class/type