change distance computation between place and address part

Instead of computing the distance to the centroid of the area
compute the distance of the area to the centroid of the feature.
This means we give preference to the area that covers the centroid.
It's still a heuristics but one that is a bit less random.
This commit is contained in:
Sarah Hoffmann
2022-04-21 21:56:59 +02:00
parent 403e6f7e5c
commit 784dad866f
3 changed files with 10 additions and 5 deletions

View File

@@ -34,7 +34,7 @@ BEGIN
NEW.parent_place_id = 0;
FOR location IN
SELECT place_id
FROM getNearFeatures(partition, NEW.geometry, NEW.rank_search)
FROM getNearFeatures(partition, NEW.geometry, NEW.geometry, NEW.rank_search)
WHERE NOT isguess ORDER BY rank_address DESC, distance asc LIMIT 1
LOOP
NEW.parent_place_id = location.place_id;