From 9056c9276fdf2d449abb27c9295a361ce31020ec Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Wed, 6 Sep 2023 10:27:03 +0200 Subject: [PATCH] add bbox output to lookup results Fixes #3149. --- nominatim/api/lookup.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nominatim/api/lookup.py b/nominatim/api/lookup.py index a46cdb69..81e6f74d 100644 --- a/nominatim/api/lookup.py +++ b/nominatim/api/lookup.py @@ -38,6 +38,7 @@ async def find_in_placex(conn: SearchConnection, place: ntyp.PlaceRef, t.c.importance, t.c.wikipedia, t.c.indexed_date, t.c.parent_place_id, t.c.rank_address, t.c.rank_search, t.c.linked_place_id, + t.c.geometry.ST_Expand(0).label('bbox'), t.c.centroid) if isinstance(place, ntyp.PlaceID): @@ -232,7 +233,8 @@ async def get_simple_place(conn: SearchConnection, place: ntyp.PlaceRef, # add missing details assert result is not None - result.bbox = getattr(row, 'bbox', None) + if hasattr(row, 'bbox'): + result.bbox = ntyp.Bbox.from_wkb(row.bbox) await nres.add_result_details(conn, [result], details) -- 2.39.5