]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge pull request #2920 from lonvia/no-postcode-for-rivers
authorSarah Hoffmann <lonvia@denofr.de>
Sat, 10 Dec 2022 16:30:32 +0000 (17:30 +0100)
committerGitHub <noreply@github.com>
Sat, 10 Dec 2022 16:30:32 +0000 (17:30 +0100)
Do not assign postcodes to long linear features

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;