osrm-backend icon indicating copy to clipboard operation
osrm-backend copied to clipboard

How to extract from_osm_id, to_osm_id, and speed for --segment-speed-file in OSRM?

Open abhishekkushwaha-fareye opened this issue 5 months ago • 0 comments

I’m trying to use osrm-customize with --segment-speed-file to apply custom speeds to OSM road segments. However, I need help extracting the required data (from_osm_id, to_osm_id, and speed) from OSM XML/PBF files. my osm file looks like this:

<way id="486802566" version="1" timestamp="2024-11-12T00:00:00Z">
  <nd ref="5317195167"/>
  <nd ref="3524650640"/>
  <nd ref="5229338522"/>
  <nd ref="3085320160"/>
  <nd ref="6424292322"/>
  <nd ref="4174899249"/>
  <nd ref="3419227097"/> 
  <!-- More nodes... -->  
  <tag k="highway" v="residential"/>  
  <tag k="maxspeed" v="30"/>  
</way>  

What I Need

from_osm_id & to_osm_id: Should these be consecutive node pairs (e.g., 5317195167 -> 3524650640 ,3524650640 -> 5229338522 ,5229338522 -> 3085320160 ,3085320160 -> 6424292322 ,6424292322 -> 4174899249 ,4174899249 -> 3419227097 ) from the way’s elements? Or is there another standard (e.g., way IDs + node positions)? speed: Should I prioritize maxspeed tags, or fall back to highway type defaults? How to handle missing/ambiguous speeds (e.g., mph vs. km/h)?

abhishekkushwaha-fareye avatar May 29 '25 12:05 abhishekkushwaha-fareye