From ba12c8adc31f845c4f563d5515fed2c1657c1b8c Mon Sep 17 00:00:00 2001 From: Famlam Date: Sun, 25 Jun 2023 23:46:01 +0200 Subject: [PATCH] (Attempt to) stop jumping markers Always use the oldest node (/relation/way if nodes don't exist) --- analysers/analyser_osmosis_wikipedia.py | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/analysers/analyser_osmosis_wikipedia.py b/analysers/analyser_osmosis_wikipedia.py index ff1bccca4..199e7ec41 100644 --- a/analysers/analyser_osmosis_wikipedia.py +++ b/analysers/analyser_osmosis_wikipedia.py @@ -26,14 +26,12 @@ sql10 = """ SELECT (array_agg(tid))[1:10], - ST_AsText(any_locate((array_agg(type))[1], (array_agg(id))[1])), + ST_AsText(any_locate(substring(MIN(tid), 1, 1), substring(MIN(tid), 2)::bigint)), w FROM (( SELECT tags->'wikipedia' AS w, - 'N' || id AS tid, - 'N' AS type, - id + 'N' || id AS tid FROM nodes WHERE @@ -41,14 +39,10 @@ tags?'wikipedia' AND NOT tags->'wikipedia' LIKE '%#%' AND NOT tags?| ARRAY['highway', 'railway', 'waterway', 'power', 'place', 'shop', 'network', 'operator'] - ORDER BY - id ) UNION ALL ( SELECT tags->'wikipedia' AS w, - 'W' || id AS tid, - 'W' AS type, - id + 'W' || id AS tid FROM ways WHERE @@ -56,14 +50,10 @@ tags?'wikipedia' AND NOT tags->'wikipedia' LIKE '%#%' AND NOT tags?| ARRAY['highway', 'railway', 'waterway', 'power', 'place', 'shop', 'network', 'operator'] - ORDER BY - id ) UNION ALL ( SELECT tags->'wikipedia' AS w, - 'R' || id AS tid, - 'R' AS type, - id + 'R' || id AS tid FROM relations WHERE @@ -72,8 +62,6 @@ NOT tags->'wikipedia' LIKE '%#%' AND NOT tags->'type' IN ('route', 'boundary') AND NOT tags?| ARRAY['highway', 'railway', 'waterway', 'power', 'place', 'shop', 'network', 'operator'] - ORDER BY - id )) AS t GROUP BY w