simplify getNearestRoadFeature function

The function only ever returns one result of which only the
place_id is used. So simplify it to return a single place_id
only (or NULL if none is found). Rename funciton to avoid
conflicts when updating an existing database.
This commit is contained in:
Sarah Hoffmann
2020-02-26 10:04:17 +01:00
parent c1ef56c870
commit 84ea0753d8
4 changed files with 16 additions and 19 deletions

View File

@@ -28,8 +28,8 @@ BEGIN
END IF;
IF out_parent_place_id IS NULL THEN
FOR location IN SELECT place_id FROM getNearestRoadFeature(out_partition, place_centroid) LOOP
out_parent_place_id := location.place_id;
SELECT getNearestRoadPlaceId(out_partition, place_centroid)
INTO out_parent_place_id;
END LOOP;
END IF;

View File

@@ -135,8 +135,7 @@ BEGIN
IF fallback THEN
IF ST_Area(bbox) < 0.01 THEN
-- for smaller features get the nearest road
SELECT place_id FROM getNearestRoadFeature(poi_partition, bbox)
INTO parent_place_id;
SELECT getNearestRoadPlaceId(poi_partition, bbox) INTO parent_place_id;
--DEBUG: RAISE WARNING 'Checked for nearest way (%)', parent_place_id;
ELSE
-- for larger features simply find the area with the largest rank that