]> git.openstreetmap.org Git - nominatim.git/commitdiff
fix polygon selection for classtable lookups
authorSarah Hoffmann <lonvia@denofr.de>
Sat, 25 Nov 2023 20:01:27 +0000 (21:01 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Sat, 25 Nov 2023 20:01:27 +0000 (21:01 +0100)
Polygons should be used preferably with higher address ranks
where the areas are smaller.

nominatim/api/search/db_searches.py

index 41434f062e1bcf26eb4fb6a7cf0f58020d887045..63da4c5d57a1d2e1ad2c4e2af2d0b6622b990e75 100644 (file)
@@ -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(
             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))))\
                                                 tgeom.c.geometry.is_area()),
                                         tgeom.c.geometry),
                                        else_ = tgeom.c.centroid.ST_Expand(0.05))))\