You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Vector tiles should join routes at concurrencies #1090
OpenHistoricalMap/ohm-deploy#562 restored a basic route_lines layer to the vector tiles for #717. This layer’s features correspond one for one to relations in OHM. However, for most purposes, styles will likely need some postprocessing to deal with route concurrencies. For example, #717 (comment) attempted to style rail routes as dotted lines, but these lines look muddy and inconsistent wherever tracks share multiple lines. Similarly, any road atlas style (#538) would need to apply a group of symbols to any overlaps between routes, but MapLibre offers no ability to group symbols across features. Historically, route concurrencies were much more common than they are today, making them even more relevant to the OHM tileset.
OSM tilesets like OpenMapTiles and Mapbox Streets perform postprocessing so that any route concurrency results in a single joined feature without any other overlapping features. As of openmaptiles/openmaptiles#1620, the joined feature contains indexed properties such as route_2_network, supporting up to six concurrent routes. This is similar to how we deduplicated boundary edges for #800, except that we’d need to expose each route-related value in a separate property instead of aggregating them into a single property. We can still partition by type or route (looks the same to me), but at least network and ref need to be exploded into indexed properties, and I guess also operator for railway routes.
It sounds interesting to use indexed properties. In OHM we have cases where the same way belongs to different routes over time—these routes changed names or types depending on the years. For example, this line belongs to 72 relations: https://www.openhistoricalmap.org/way/199785129. If a way belongs to 72 or more relations, I don’t think it would be practical to add indexing like route_72_ref, route_72_network. Maybe it would be better to first evaluate the dates, similar to what was done with the boundary lines.
In the case of #800, the evaluation was more geometry-focused. It considered admin_level, start_date, and end_date, performing an overlap check where dates align and where admin_level is the same. But for routes, we would also need to process name, network, ref, start_date, and end_date. Perhaps we could first group by date ranges and then use indexed properties—essentially creating an indexation based on temporal ranges
Perhaps we could first group by date ranges and then use indexed properties—essentially creating an indexation based on temporal ranges
Yes, exactly. An index only makes sense among a set of route memberships that’s all active during a given time period. The end goal would be a single feature that coalesces the information about multiple concurrent routes, all of which can be presented simultaneously when the time slider is set to a date within that range.
OpenMapTiles additionally has some built-in rules for sorting route memberships to determine these indices. I think it counts the number of colons in network=* and maybe prioritizes *:national over *:regional, etc.
I recall that the initial implementation of this functionality in OpenMapTiles required some large table joins, so performance could be a concern.
Route A is active from 1900–2000
Route B is active from 1990–2024
Result:
Segment 1: 1900–1990 → Route A only
Segment 2: 1990–2000 → Routes A + B
Segment 3: 2000–2024 → Route B only
Case 2:
Route A is active from 1900–2000
Route B is active from 2001-2024
Result:
Segment 1: 1900–2000 → Route A only
Segment 2: 2001–2024 → Route B only
Case 3
Route A: 1900 – NULL
Route B: 2001 – NULL
Results:
Segment 1: 1900–2001 → Route A only
Segment 2: 2001–∞ → Routes A + B
OpenMapTiles additionally has some built-in rules for sorting route memberships to determine these indices. I think it counts the number of colons in network=* and maybe prioritizes *:national over *:regional, etc.
About these statements, it is something that we need to check regarding the prioritization in the lower indexes . So far, I am using this function. I think the lower indexes, like 1 and 2, are the most important, while those that go up to 6 are not as important.
The way belongs to 18 relation, it reduce to 15 segments in the vtiles according the date rage splits
The example is from a region where the tagging is fairly atypical compared to conventional OSM tagging. The way is a member of many bus route relations, which will be useful to include but probably won’t be depicted in the same style as road route relations. If we intend to include bus route relations, we’ll need to expose network:wikidata=* instead of network=*, which is neither hierarchical nor unique for public transport routes.
If it doesn’t impact performance too greatly, then yes, I suppose it would be useful for public transport routes. This QLever query turns up some ways that are part of many route relations (as much as 72) that are more likely to overlap in time.
Increasing the maximum concurrency has the downside that stylesheets would need to look for all those higher-numbered properties, even if they only care about one kind of route. I wonder if we should segment the route properties by type, for example, road_route_#_* versus bus_route_#_*, or even split them into different layers. At least we would want to sort the routes by type, since no style would want to randomly mix the different types together when labeling a street.
The most extreme overlap so far is U.S. 24/25, which is part of up to four simultaneous routes. This reminds me that we should deduplicate routes by direction=*. We can assume that no style wants to visually distinguish the eastbound and westbound lanes of a road route with distinct shields, or the inbound and outbound directions of a metro line with distinct logos. Without that visual distinction, the user will perceive redundant shields: osm-americana/openstreetmap-americana#423 (comment).
About these statements, it is something that we need to check regarding the prioritization in the lower indexes . So far, I am using this function. I think the lower indexes, like 1 and 2, are the most important, while those that go up to 6 are not as important.
Yes, numerically lower indices are more important. It looks like we’re currently only sorting the routes by route number. This is a good start, but we’ll need to beef up this logic a bit.
For route=road, count the number of colons (:) in the network=* tag. A network with fewer colons is more important than a network with more colons. In case of a tie, a network that contains :national is more important than :regional, :prefectural, :provincial, etc. It doesn’t need to be perfect. Finally, we can sort numerically by ref=*.
For public transport routes, we can’t count colons, but I think we can simply sort alphabetically by network=* for now, followed by sorting by ref=*. If we need to prioritize routes by frequency or other attributes, we’ll need to come up with tagging for that first.
For recreational routes, such as cycling routes, OSM unfortunately adopted an entirely different network=* scheme. We can treat recreational routes as tail work, since there’s literally only a single bike route in OHM so far.
I've updated the scripts to provide support for the route_ naming pattern. This approach is much better for maintaining a single linestring. However, note that we're currently only considering route types: 'road', 'train', 'subway', 'light_rail', 'tram', 'trolleybus', and 'bus'.
Railway and ferry routes are handled within transport_lines.
I also found some other routes that are less used. There are only a couple of objects of this type for now, but we can add more later if needed in the route_lines
Activity
Rub21 commentedon Jul 6, 2025
It sounds interesting to use indexed properties. In OHM we have cases where the same way belongs to different routes over time—these routes changed names or types depending on the years. For example, this line belongs to 72 relations: https://www.openhistoricalmap.org/way/199785129. If a way belongs to 72 or more relations, I don’t think it would be practical to add indexing like route_72_ref, route_72_network. Maybe it would be better to first evaluate the dates, similar to what was done with the boundary lines.
In the case of #800, the evaluation was more geometry-focused. It considered admin_level, start_date, and end_date, performing an overlap check where dates align and where admin_level is the same. But for routes, we would also need to process name, network, ref, start_date, and end_date. Perhaps we could first group by date ranges and then use indexed properties—essentially creating an indexation based on temporal ranges
1ec5 commentedon Jul 6, 2025
Yes, exactly. An index only makes sense among a set of route memberships that’s all active during a given time period. The end goal would be a single feature that coalesces the information about multiple concurrent routes, all of which can be presented simultaneously when the time slider is set to a date within that range.
OpenMapTiles additionally has some built-in rules for sorting route memberships to determine these indices. I think it counts the number of colons in
network=*and maybe prioritizes*:nationalover*:regional, etc.I recall that the initial implementation of this functionality in OpenMapTiles required some large table joins, so performance could be a concern.
Rub21 commentedon Sep 18, 2025
PR: OpenHistoricalMap/ohm-deploy#600
The route indexation have been deployed in staging , https://vtiles.staging.openhistoricalmap.org/#20/51.2028988/3.2179703 ,
Case 1:
Route A is active from 1900–2000
Route B is active from 1990–2024
Result:
Segment 1: 1900–1990 → Route A only
Segment 2: 1990–2000 → Routes A + B
Segment 3: 2000–2024 → Route B only
Case 2:
Route A is active from 1900–2000
Route B is active from 2001-2024
Result:
Segment 1: 1900–2000 → Route A only
Segment 2: 2001–2024 → Route B only
Case 3
Route A: 1900 – NULL
Route B: 2001 – NULL
Results:
Segment 1: 1900–2001 → Route A only
Segment 2: 2001–∞ → Routes A + B
About these statements, it is something that we need to check regarding the prioritization in the lower indexes . So far, I am using this function. I think the lower indexes, like 1 and 2, are the most important, while those that go up to 6 are not as important.
Also, there are cases when, in a particular range of time, there are more than 6 relation concurrencies. Do you think this could be increased to 8, e.g https://www.openhistoricalmap.org/way/199888000
https://gist.github.com/Rub21/6e28d0a9dfd924cfeb86e495e75fcda2
Rub21 commentedon Sep 18, 2025
Here a example: for https://www.openhistoricalmap.org/way/199888283
The way belongs to 18 relation, it reduce to 15 segments in the vtiles according the date rage splits
https://tiler-compare.openhistoricalmap.org/check-properties/index.html#18.19/51.051139/3.733801

1ec5 commentedon Sep 19, 2025
The example is from a region where the tagging is fairly atypical compared to conventional OSM tagging. The way is a member of many bus route relations, which will be useful to include but probably won’t be depicted in the same style as road route relations. If we intend to include bus route relations, we’ll need to expose
network:wikidata=*instead ofnetwork=*, which is neither hierarchical nor unique for public transport routes.If it doesn’t impact performance too greatly, then yes, I suppose it would be useful for public transport routes. This QLever query turns up some ways that are part of many route relations (as much as 72) that are more likely to overlap in time.
Increasing the maximum concurrency has the downside that stylesheets would need to look for all those higher-numbered properties, even if they only care about one kind of route. I wonder if we should segment the route properties by type, for example,
road_route_#_*versusbus_route_#_*, or even split them into different layers. At least we would want to sort the routes by type, since no style would want to randomly mix the different types together when labeling a street.For road routes, most of the concurrencies are still simpler, like this two-route same-time concurrency. The ways for Interstate 70, California State Route 152, and Japan National Route 2 are part of the most road route relations, but none of them overlap in time.
The most extreme overlap so far is U.S. 24/25, which is part of up to four simultaneous routes. This reminds me that we should deduplicate routes by
direction=*. We can assume that no style wants to visually distinguish the eastbound and westbound lanes of a road route with distinct shields, or the inbound and outbound directions of a metro line with distinct logos. Without that visual distinction, the user will perceive redundant shields: osm-americana/openstreetmap-americana#423 (comment).Yes, numerically lower indices are more important. It looks like we’re currently only sorting the routes by route number. This is a good start, but we’ll need to beef up this logic a bit.
For
route=road, count the number of colons (:) in thenetwork=*tag. A network with fewer colons is more important than a network with more colons. In case of a tie, a network that contains:nationalis more important than:regional,:prefectural,:provincial, etc. It doesn’t need to be perfect. Finally, we can sort numerically byref=*.For public transport routes, we can’t count colons, but I think we can simply sort alphabetically by
network=*for now, followed by sorting byref=*. If we need to prioritize routes by frequency or other attributes, we’ll need to come up with tagging for that first.For recreational routes, such as cycling routes, OSM unfortunately adopted an entirely different
network=*scheme. We can treat recreational routes as tail work, since there’s literally only a single bike route in OHM so far.Rub21 commentedon Sep 25, 2025
I've updated the scripts to provide support for the route_ naming pattern. This approach is much better for maintaining a single linestring. However, note that we're currently only considering route types: 'road', 'train', 'subway', 'light_rail', 'tram', 'trolleybus', and 'bus'.
https://tiler-compare.openhistoricalmap.org/check-properties/index.html#18.19/51.051139/3.733801

Railway and ferry routes are handled within transport_lines.
I also found some other routes that are less used. There are only a couple of objects of this type for now, but we can add more later if needed in the route_lines
Rub21 commentedon Sep 29, 2025
I have added the direction value in the indexed attributes.
Also already deployed in staging
Rub21 commentedon Oct 14, 2025
This is been completed with he PR #1162 and next steps here: #1162