Skip to content

Commit 529d82f

Browse files
committed
Place hits: the bigger town a region counts for keeps its own state (Heidiland's Bad Ragaz is SG, not GR)
1 parent 45c0a51 commit 529d82f

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎propose_segments.py‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6830,7 +6830,13 @@ def _hit_locality(hit, df, countries, at=None, named=False):
68306830
if town and named:
68316831
town = re.sub(r' Township$', '', town)
68326832
elif town and at:
6833-
town = _major_town(at[0], at[1], town, kind) or town
6833+
major = _major_town(at[0], at[1], town, kind)
6834+
# ... in its own state: Heidiland's point is in Graubünden, its Bad Ragaz in St. Gallen (70ajJy6tPBs, tvfjm;
6835+
# user, 2026-11-14)
6836+
p = major and next((p for p in _nearby_places(at[0], at[1]) or [] if p[0] == major), None)
6837+
if p and (there := _country_region_at(p[2], p[3])) and there[0] == code and (there[1] or there[2]):
6838+
region_code, region = there[1], there[2]
6839+
town = major or town
68346840
if code not in countries:
68356841
return None
68366842
rows = df[df['country'] == countries[code]]

0 commit comments

Comments
 (0)