Fix type classifier: POI check takes precedence over street_address

Businesses with housenumbers (e.g. M&W Markets at 130 US-30) were
classified as street_address because the housenumber check fired before
the osm_key check. Reorder so osm_key in amenity/shop/tourism/leisure/office
is evaluated first, ensuring businesses get type=poi regardless of
whether they have a street address. Also adds office to the POI key set.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Matt 2026-04-21 19:08:04 +00:00
commit d460f0e202

View file

@ -325,12 +325,12 @@ def _parse_photon_features(features, source):
feat_type = props.get('type', '') feat_type = props.get('type', '')
has_hn = bool(props.get('housenumber')) has_hn = bool(props.get('housenumber'))
if has_hn or osm_value in ('house', 'residential'): if osm_key in ('amenity', 'shop', 'tourism', 'leisure', 'office'):
rtype = 'poi'
elif has_hn or osm_value in ('house', 'residential'):
rtype = 'street_address' rtype = 'street_address'
elif feat_type in ('city', 'town', 'village', 'hamlet', 'county', 'state', 'country'): elif feat_type in ('city', 'town', 'village', 'hamlet', 'county', 'state', 'country'):
rtype = 'locality' rtype = 'locality'
elif osm_key in ('amenity', 'shop', 'tourism', 'leisure'):
rtype = 'poi'
else: else:
rtype = 'poi' rtype = 'poi'