X-Git-Url: https://git.openstreetmap.org/nominatim.git/blobdiff_plain/a873f260cfbbd878bd4b67f55389211b9833d1e8..76eadc562cdb02ed67899281d46893d9b091e29b:/lib-sql/functions/placex_triggers.sql diff --git a/lib-sql/functions/placex_triggers.sql b/lib-sql/functions/placex_triggers.sql index 58e5f2a8..841b7fd6 100644 --- a/lib-sql/functions/placex_triggers.sql +++ b/lib-sql/functions/placex_triggers.sql @@ -1241,7 +1241,9 @@ BEGIN 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); + NEW.postcode := get_nearest_postcode(NEW.country_code, + CASE WHEN NEW.rank_address > 25 + THEN NEW.centroid ELSE NEW.geometry END); END IF; {% if debug %}RAISE WARNING 'place update % % finished.', NEW.osm_type, NEW.osm_id;{% endif %}