From b700f88da66cf06d14001c8809954e6cf28155dc Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Sat, 4 Nov 2023 21:22:09 +0000 Subject: [PATCH] boundary=place is valid Example: 51.4564, -0.6486 -> Windsor (Q464955) --- geocode/model.py | 1 + lookup.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/geocode/model.py b/geocode/model.py index 7e7695d..fda5232 100644 --- a/geocode/model.py +++ b/geocode/model.py @@ -54,6 +54,7 @@ class Polygon(Base): q = cls.query.filter( or_( cls.boundary == "political", + cls.boundary == "place", and_( cls.admin_level.isnot(None), # type: ignore cls.admin_level.regexp_match(r"^\d+$"), # type: ignore diff --git a/lookup.py b/lookup.py index 575c339..c63fe5a 100755 --- a/lookup.py +++ b/lookup.py @@ -134,7 +134,7 @@ def osm_lookup( assert e.tags tags: typing.Mapping[str, str] = e.tags admin_level: int | None = get_admin_level(tags) - if not admin_level and tags.get("boundary") != "political": + if not admin_level and tags.get("boundary") not in ("political", "place"): continue if not ( (hit := hit_from_wikidata_tag(tags))