Repository navigation
Route indexing by date range - #600
Conversation
1ec5
left a comment
There was a problem hiding this comment.
This is very exciting! It’s mostly working as I expected. I added some notes based on OpenHistoricalMap/issues#1090 (comment), focusing on things we’d probably want to address before launch to avoid having to coordinate style changes later.
| 'name', name, | ||
| 'type', type, | ||
| 'operator', operator, | ||
| 'direction', direction, |
There was a problem hiding this comment.
We should group by direction to avoid redundant labels.
There was a problem hiding this comment.
That’s OK, but what if a roadway is a member of both the east and west directions of the same-numbered route? Technically a numbered route is supposed to have two different relations going in opposite directions. (For public transit routes, this is required by the PTv2 schema.) If the route follows a two-way road, then that roadway will be a member of both relations. In that case, we only want to show the route just once. Otherwise, there will be two identical-looking shields.
For example, Pacheco Pass is a member of both eastbound and westbound CA 152. In the route_lines layer, the feature has too many route properties:
| Key | Value |
|---|---|
route_road_1_ref |
152 |
route_road_1_network |
US:CA |
route_road_1_direction |
west |
route_road_2_ref |
152 |
route_road_2_network |
US:CA |
route_road_2_direction |
east |
Ideally this would get collapsed down to:
| Key | Value |
|---|---|
route_road_1_ref |
152 |
route_road_1_network |
US:CA |
If this would be challenging, I’m OK with splitting this off as a separate task. It just means duplicate shields for now.
There was a problem hiding this comment.
Oh, I see, my comment in #600 (comment) was confusing. We should make sure to group the routes so that different direction=* values does not result in multiple features if everything else matches. So I guess that part of 59d73dc would unfortunately need to be undone. That seems to be the last thing before we land this feature.
There was a problem hiding this comment.
@1ec5 Are you saying we should consider splitting relations that have a direction (e.g., east, west) into two separate ways? Currently, the indexed directions are shown on a single way. but won't be a much problem to split in diferente ways.
There was a problem hiding this comment.
Sounds good, I am going to revert the changes
There was a problem hiding this comment.
From : https://www.openhistoricalmap.org/way/199823764

https://tiler-compare.openhistoricalmap.org/check-properties/index.html#17.57/37.003715/-121.370645
It seems we don’t need to revert any changes, because the routes currently indexed as route_road_1_direction and route_road_2_direction —as shown in the image (purple)—actually correspond to a single way in the vector tiles, even though they appear as two separate relations in the OSM database. Since their date ranges (1965-04-29 and 1991-12-31) and attributes match, the algorithm determined they should be represented as just one feature, indexing the attributes
But the routes marked in red should indeed be merged into a single feature, since the start date of the first matches the end date of the second. I’ll double-check that point.
I think the direction handling is correct—it only displays as a single route. Regarding the commit 59d73dc
I initially tried separating them, but it didn’t make much sense, so I concluded that including the direction in the index . Or maybe I’m misunderstanding something?
There was a problem hiding this comment.
As noted in #600 (comment), it should be a single route_road_*_* – just one, not two.
Fix routes direction Fix column name for route lines Update columns for route lines
72c34e5 to
33a1b01
Compare


From: OpenHistoricalMap/issues#1090
This PR introduces a strategy for route indexing and generalization to optimize map rendering performance (Mapbox/MapLibre style) and styling
How this works?
🔹 Database Changes
Added new columns (start_decdate, end_decdate) in both osm_route_multilines and osm_route_lines.
These columns store the decimal start/end dates and are automatically updated when the feature history changes. like we did for boundaries
🔹 Normalized route view
Created a new materialized view mv_routes_normalized which groups routes by start_decdate / end_decdate.
This view splits routes into temporal segments depending on overlap between different relations.
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
This way we will have a line graph for each range that will contain the route information for that time range.
cc. @1ec5