Coalesce duplicate route concurrencies (#1361)

# Problem description
#1128 introduced route relation concurrency information in OpenMapTiles via the `route_X` attributes.  The original implementation assumed that there would be a single route relation for each `network` and `ref` pair.  However, it is increasingly common practice to tag a separate route relation for each direction of a route in order to provide awareness to routers and other data consumers of the directionality of a route.  This standard and growing practice is described on the [OSM wiki page on route directions](https://wiki.openstreetmap.org/wiki/Route_directions).  Thus, the naïve implementation of #1128 caused duplicate entries to be added as `route_X` attributes in the case where separate route relations were used for directional routes.

# Solution description
This PR adds grouping when computing route concurrency information, such that duplicate entries are coalesced in a predictable way.  Since this grouping is done only within a route membership join of a single member way, the computational complexity should be trivial.
This commit is contained in:
Brian Sperlongano
2023-01-26 10:15:47 -05:00
committed by GitHub
parent efa6b27fba
commit bc9bbd2e67
3 changed files with 36 additions and 0 deletions

View File

@@ -160,6 +160,13 @@ BEGIN
INSERT INTO omt_test_failures VALUES(500, 'import', 'osm_transportation_name_linestring z12 route_rank expected 1, got ' || cnt);
END IF;
-- Duplicate route concurrencies collapsed
SELECT COUNT(*) INTO cnt FROM osm_route_member
WHERE network='US:I' AND ref='95';
IF cnt <> 1 THEN
INSERT INTO omt_test_failures VALUES(500, 'import', 'osm_route_member 1 route membership expected, got ' || cnt);
END IF;
-- Test 600
-- verify that atms are imported with correct name which can come from tags like operator or network