]> git.openstreetmap.org Git - nominatim.git/commitdiff
always compute guessed postcode for POIs from centroid
authorSarah Hoffmann <lonvia@denofr.de>
Wed, 26 May 2021 09:04:02 +0000 (11:04 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Wed, 26 May 2021 09:15:13 +0000 (11:15 +0200)
When guessing postcodes from the area, only postcodes within
that area are accepted. For POIs that is usually not what we
want as the postcode would have to be within a house for
example.

Fixes #2301.

lib-sql/functions/placex_triggers.sql

index 9a31f3ae327c338dc0d1538f68b51e03f1591148..e3be9503aa84eadca65e2f74d07e6e7aa5835d4b 100644 (file)
@@ -911,7 +911,7 @@ BEGIN
       -- determine postcode
       NEW.postcode := coalesce(token_normalized_postcode(NEW.address->'postcode'),
                                location.postcode,
-                               get_nearest_postcode(NEW.country_code, NEW.geometry));
+                               get_nearest_postcode(NEW.country_code, NEW.centroid));
 
       IF NEW.name is not NULL THEN
           NEW.name := add_default_place_name(NEW.country_code, NEW.name);