mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-12 05:44:06 +00:00
use only centroid to get parent admin boundaries
Using the full geometry is far too expensive.
This commit is contained in:
@@ -581,6 +581,11 @@ BEGIN
|
|||||||
RETURN NEW;
|
RETURN NEW;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
|
-- Speed up searches - just use the centroid of the feature
|
||||||
|
-- cheaper but less acurate
|
||||||
|
NEW.centroid := ST_PointOnSurface(NEW.geometry);
|
||||||
|
--DEBUG: RAISE WARNING 'Computing preliminary centroid at %',ST_AsText(NEW.centroid);
|
||||||
|
|
||||||
-- recompute the ranks, they might change when linking changes
|
-- recompute the ranks, they might change when linking changes
|
||||||
SELECT * INTO NEW.rank_search, NEW.rank_address
|
SELECT * INTO NEW.rank_search, NEW.rank_address
|
||||||
FROM compute_place_rank(NEW.country_code,
|
FROM compute_place_rank(NEW.country_code,
|
||||||
@@ -591,8 +596,8 @@ BEGIN
|
|||||||
(NEW.extratags->'capital') = 'yes',
|
(NEW.extratags->'capital') = 'yes',
|
||||||
NEW.address->'postcode');
|
NEW.address->'postcode');
|
||||||
-- We must always increase the address level relative to the admin boundary.
|
-- We must always increase the address level relative to the admin boundary.
|
||||||
IF NEW.class = 'boundary' and NEW.type = 'administrative' THEN
|
IF NEW.class = 'boundary' and NEW.type = 'administrative' and NEW.osm_type = 'R' THEN
|
||||||
parent_address_level := get_parent_address_level(NEW.geometry, NEW.admin_level);
|
parent_address_level := get_parent_address_level(NEW.centroid, NEW.admin_level);
|
||||||
IF parent_address_level >= NEW.rank_address THEN
|
IF parent_address_level >= NEW.rank_address THEN
|
||||||
IF parent_address_level >= 24 THEN
|
IF parent_address_level >= 24 THEN
|
||||||
NEW.rank_address := 25;
|
NEW.rank_address := 25;
|
||||||
@@ -632,11 +637,6 @@ BEGIN
|
|||||||
END IF;
|
END IF;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
-- Speed up searches - just use the centroid of the feature
|
|
||||||
-- cheaper but less acurate
|
|
||||||
NEW.centroid := ST_PointOnSurface(NEW.geometry);
|
|
||||||
--DEBUG: RAISE WARNING 'Computing preliminary centroid at %',ST_AsText(NEW.centroid);
|
|
||||||
|
|
||||||
NEW.postcode := null;
|
NEW.postcode := null;
|
||||||
|
|
||||||
-- recalculate country and partition
|
-- recalculate country and partition
|
||||||
|
|||||||
Reference in New Issue
Block a user