mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-16 15:47:58 +00:00
move geometry split into insertLocationAreaLarge()
thus insert only needs to be called once.
This commit is contained in:
@@ -125,14 +125,16 @@ BEGIN
|
|||||||
|
|
||||||
IF in_rank_search <= 4 and not in_estimate THEN
|
IF in_rank_search <= 4 and not in_estimate THEN
|
||||||
INSERT INTO location_area_country (place_id, country_code, geometry)
|
INSERT INTO location_area_country (place_id, country_code, geometry)
|
||||||
values (in_place_id, in_country_code, in_geometry);
|
(SELECT in_place_id, in_country_code, geom
|
||||||
|
FROM split_geometry(in_geometry) as geom);
|
||||||
RETURN TRUE;
|
RETURN TRUE;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
{% for partition in db.partitions %}
|
{% for partition in db.partitions %}
|
||||||
IF in_partition = {{ partition }} THEN
|
IF in_partition = {{ partition }} THEN
|
||||||
INSERT INTO location_area_large_{{ partition }} (partition, place_id, country_code, keywords, rank_search, rank_address, isguess, postcode, centroid, geometry)
|
INSERT INTO location_area_large_{{ partition }} (partition, place_id, country_code, keywords, rank_search, rank_address, isguess, postcode, centroid, geometry)
|
||||||
values (in_partition, in_place_id, in_country_code, in_keywords, in_rank_search, in_rank_address, in_estimate, postcode, in_centroid, in_geometry);
|
(SELECT in_partition, in_place_id, in_country_code, in_keywords, in_rank_search, in_rank_address, in_estimate, postcode, in_centroid, geom
|
||||||
|
FROM split_geometry(in_geometry) as geom);
|
||||||
RETURN TRUE;
|
RETURN TRUE;
|
||||||
END IF;
|
END IF;
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
@@ -348,8 +348,6 @@ CREATE OR REPLACE FUNCTION add_location(place_id BIGINT, country_code varchar(2)
|
|||||||
RETURNS BOOLEAN
|
RETURNS BOOLEAN
|
||||||
AS $$
|
AS $$
|
||||||
DECLARE
|
DECLARE
|
||||||
locationid INTEGER;
|
|
||||||
secgeo GEOMETRY;
|
|
||||||
postcode TEXT;
|
postcode TEXT;
|
||||||
BEGIN
|
BEGIN
|
||||||
PERFORM deleteLocationArea(partition, place_id, rank_search);
|
PERFORM deleteLocationArea(partition, place_id, rank_search);
|
||||||
@@ -360,18 +358,19 @@ BEGIN
|
|||||||
postcode := upper(trim (in_postcode));
|
postcode := upper(trim (in_postcode));
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
IF ST_GeometryType(geometry) in ('ST_Polygon','ST_MultiPolygon') THEN
|
IF ST_Dimension(geometry) = 2 THEN
|
||||||
FOR secgeo IN select split_geometry(geometry) AS geom LOOP
|
RETURN insertLocationAreaLarge(partition, place_id, country_code, keywords,
|
||||||
PERFORM insertLocationAreaLarge(partition, place_id, country_code, keywords, rank_search, rank_address, false, postcode, centroid, secgeo);
|
rank_search, rank_address, false, postcode,
|
||||||
END LOOP;
|
centroid, geometry);
|
||||||
|
|
||||||
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, centroid, secgeo);
|
|
||||||
|
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
RETURN true;
|
IF ST_Dimension(geometry) = 0 THEN
|
||||||
|
RETURN insertLocationAreaLarge(partition, place_id, country_code, keywords,
|
||||||
|
rank_search, rank_address, true, postcode,
|
||||||
|
centroid, place_node_fuzzy_area(geometry, rank_search));
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
RETURN false;
|
||||||
END;
|
END;
|
||||||
$$
|
$$
|
||||||
LANGUAGE plpgsql;
|
LANGUAGE plpgsql;
|
||||||
|
|||||||
Reference in New Issue
Block a user