Summary
OSRM already exposes per-segment route annotations such as distance, duration, weight, datasources, speed, and nodes, but it does not expose the OSM way ID for each traversed segment.
This makes it hard for clients to answer questions like:
- which OSM ways were traversed?
- how should adjacent traversed segments be grouped by way?
- how much route distance belongs to each way ID?
Proposed change
Add support for annotations=way_ids to route-like responses.
Expected behavior:
annotations=way_ids returns a per-segment way_ids array aligned with other per-segment annotations
annotations=true includes way_ids as part of the full annotation set
- support should be available consistently in JSON, FlatBuffers, HTTP parsing, and Node.js bindings
Example:
{
"annotation": {
"distance": [5, 5, 10],
"duration": [1, 1, 2],
"weight": [1, 1, 2],
"way_ids": [111, 111, 222]
}
}
Why this would help
This would make OSRM more useful for clients that need route post-processing, including:
grouping route geometry by original OSM way
attributing distance or duration to specific ways
debugging or visualizing route traversal against OSM data
downstream map-matching / analytics workflows
Compatibility
This would be an additive API change.
Existing clients would be unaffected unless they explicitly request way_ids, except that annotations=true would include one additional annotation field.
Related work
Implementation PR:
#7444
Summary
OSRM already exposes per-segment route annotations such as
distance,duration,weight,datasources,speed, andnodes, but it does not expose the OSM way ID for each traversed segment.This makes it hard for clients to answer questions like:
Proposed change
Add support for
annotations=way_idsto route-like responses.Expected behavior:
annotations=way_idsreturns a per-segmentway_idsarray aligned with other per-segment annotationsannotations=trueincludesway_idsas part of the full annotation setExample:
{ "annotation": { "distance": [5, 5, 10], "duration": [1, 1, 2], "weight": [1, 1, 2], "way_ids": [111, 111, 222] } }Why this would help
This would make OSRM more useful for clients that need route post-processing, including:
grouping route geometry by original OSM way
attributing distance or duration to specific ways
debugging or visualizing route traversal against OSM data
downstream map-matching / analytics workflows
Compatibility
This would be an additive API change.
Existing clients would be unaffected unless they explicitly request way_ids, except that annotations=true would include one additional annotation field.
Related work
Implementation PR:
#7444