X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/2fe3c654fc96eb72047c0d2dd2beadc840ad48b4..3c7519444867cd9c6b3003c4c88729df21b8c265:/sql/functions/utils.sql?ds=sidebyside diff --git a/sql/functions/utils.sql b/sql/functions/utils.sql index 08e82c5b..0a49eef5 100644 --- a/sql/functions/utils.sql +++ b/sql/functions/utils.sql @@ -301,12 +301,12 @@ LANGUAGE plpgsql IMMUTABLE; CREATE OR REPLACE FUNCTION add_location(place_id BIGINT, country_code varchar(2), partition INTEGER, keywords INTEGER[], rank_search INTEGER, rank_address INTEGER, - in_postcode TEXT, geometry GEOMETRY) + in_postcode TEXT, geometry GEOMETRY, + centroid GEOMETRY) RETURNS BOOLEAN AS $$ DECLARE locationid INTEGER; - centroid GEOMETRY; secgeo GEOMETRY; postcode TEXT; BEGIN @@ -319,15 +319,13 @@ BEGIN END IF; IF ST_GeometryType(geometry) in ('ST_Polygon','ST_MultiPolygon') THEN - centroid := ST_Centroid(geometry); - FOR secgeo IN select split_geometry(geometry) AS geom LOOP PERFORM insertLocationAreaLarge(partition, place_id, country_code, keywords, rank_search, rank_address, false, postcode, centroid, secgeo); END LOOP; ELSEIF ST_GeometryType(geometry) = 'ST_Point' THEN secgeo := place_node_fuzzy_area(geometry, rank_search); - PERFORM insertLocationAreaLarge(partition, place_id, country_code, keywords, rank_search, rank_address, true, postcode, geometry, secgeo); + PERFORM insertLocationAreaLarge(partition, place_id, country_code, keywords, rank_search, rank_address, true, postcode, centroid, secgeo); END IF;