BUGFIX: Ignore duplicate route concurrencies (#1233)
While troubleshooting #1230, I discovered that there were cases where a way was a member of the same route relation more than once, such as: https://www.openstreetmap.org/way/17439235 <img src="https://user-images.githubusercontent.com/3254090/133726616-acd01332-343e-4930-ad3d-1fb3c3190a4c.png" width=280/> This segment would end up showing duplicate highway shields in a rendered style, which is not desirable. While I personally think this style of tagging is wrong, it's a relatively easy fix to remove those duplicates. This PR replaces `ROW_NUMBER()` with `DENSE_RANK()` in the concurrency index generation code and adds a `DISTINCT` constraint on the concurrency join to handle multiple member rows with the same concurrency index. Since I was in this file, I also fixed the copy/paste error in generating the route names. Screenshot from database showing correct mapping: 
This commit is contained in:
committed by
GitHub
parent
5b0c28929f
commit
8b6e69e440
@@ -85,7 +85,7 @@ ALTER TABLE osm_route_member ADD COLUMN IF NOT EXISTS concurrency_index int;
|
||||
INSERT INTO osm_route_member (id, concurrency_index)
|
||||
SELECT
|
||||
id,
|
||||
ROW_NUMBER() over (PARTITION BY member ORDER BY network_type, network, LENGTH(ref), ref) AS concurrency_index
|
||||
DENSE_RANK() over (PARTITION BY member ORDER BY network_type, network, LENGTH(ref), ref) AS concurrency_index
|
||||
FROM osm_route_member
|
||||
ON CONFLICT (id) DO UPDATE SET concurrency_index = EXCLUDED.concurrency_index;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user