From d6fe58f84e8351f2ee131864fa21678cbd3d37d4 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Sat, 25 Nov 2023 21:01:27 +0100 Subject: [PATCH] fix polygon selection for classtable lookups Polygons should be used preferably with higher address ranks where the areas are smaller. --- nominatim/api/search/db_searches.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nominatim/api/search/db_searches.py b/nominatim/api/search/db_searches.py index 41434f06..63da4c5d 100644 --- a/nominatim/api/search/db_searches.py +++ b/nominatim/api/search/db_searches.py @@ -296,7 +296,7 @@ class NearSearch(AbstractSearch): sql = sql.join(table, t.c.place_id == table.c.place_id)\ .join(tgeom, table.c.centroid.ST_CoveredBy( - sa.case((sa.and_(tgeom.c.rank_address < 9, + sa.case((sa.and_(tgeom.c.rank_address > 9, tgeom.c.geometry.is_area()), tgeom.c.geometry), else_ = tgeom.c.centroid.ST_Expand(0.05))))\ -- 2.39.5