Use fallback if Scottish civil parish lookup fails

This commit is contained in:
Edward Betts 2023-12-27 15:06:14 +00:00
parent 9112c685c4
commit 88d46c1dcd
1 changed files with 2 additions and 1 deletions

View File

@ -114,7 +114,8 @@ def lat_lon_to_wikidata(lat: float, lon: float) -> dict[str, typing.Any]:
elements = []
result = wikidata.build_dict(hit, lat, lon)
return {"elements": elements, "result": result}
if not result.get("missing"):
return {"elements": elements, "result": result}
elements = model.Polygon.coords_within(lat, lon)
result = do_lookup(elements, lat, lon)