]> git.openstreetmap.org Git - nominatim.git/commitdiff
do not assign postcodes to long linear features
authorSarah Hoffmann <lonvia@denofr.de>
Sat, 10 Dec 2022 13:53:08 +0000 (14:53 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Wed, 22 Mar 2023 09:35:13 +0000 (10:35 +0100)
This avoids a postcode in particular for waterway features and
long natural featues like ridges and valleys.

Fixes #2915.

lib-sql/functions/placex_triggers.sql

index a8fb9fcc2cf02d3b54541065b280fa6e0d5a7852..295b838eeeb55e6005d34e8be53de5045586446d 100644 (file)
@@ -1230,7 +1230,11 @@ BEGIN
     {% endif %}
   END IF;
 
-  IF NEW.postcode is null AND NEW.rank_search > 8 THEN
+  IF NEW.postcode is null AND NEW.rank_search > 8
+     AND (NEW.rank_address > 0
+          OR ST_GeometryType(NEW.geometry) not in ('ST_LineString','ST_MultiLineString')
+          OR ST_Length(NEW.geometry) < 0.02)
+  THEN
     NEW.postcode := get_nearest_postcode(NEW.country_code, NEW.geometry);
   END IF;