I have my own routing server that uses OSRM as an routing engine. (I used this toturial.)

I want to be able to add my own data (roads) and include that data in the routing.

So in the beginning I thought to add my data in the OSM format (node, way, relation) with an id that doesn't exist in the xml file to the osm.xml file that the OSRM uses to route. But that will mess up the id's coming from the OSM server in case of updating the data (diff).

So now I'm wordering if there is any way to use OSRM with my own data.

  • Even if it is easy with OSRM (I do not know) merging two topologies is a mess. When do you decide (automated) if it is a new or different road or just a changed existing one or a longer one etc? Where to append and merge nodes in the other network? So, as nickves, I suggest to contribute your road data back to OSM and have a much simpler procedure. If that is "not possible" the chances are still high that the OSM share alike license would even force you to release it or the created result.
    – Karussell
    Oct 19 '15 at 7:15
  • Networks can be for neighbour regions.Then mess will be minimal if regions are with good borders.
    – Kostadin
    Oct 21 '15 at 7:29
  • I am trying to do the same, I need the data from buildings to avoid routing but I am trying to not use the data from my own nodes. What should I do ? Mar 30 '19 at 17:21
  • This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. You can also add a bounty to draw more attention to this question once you have enough reputation. - From Review
    – Vince
    Mar 30 '19 at 18:56

If you only want to use your own data, I would suggest writing a script that converts it to the OSM XML format. We have done this in the past with proprietary data sets and it works fine (albeit you might consider writing out the PBF format if the data size is very large).

Merging OSM and non-OSM data is whole different story. That is nothing that can be solved on the OSRM side. Can you give more details on the nature of your data? Can it be added back to OSM? Does it contain own geometry or just remove geometry (you could disable specific roads in the profile)?

  • Thank you! Thats what I decided to do in the end. It seems to be the simplest solution.
    – Shmuli
    Oct 19 '15 at 14:18

The good way would be to Contribute your data to OSM so they would be included in the future osm extracts.

If for some reason you cannot do that; Use data staging techniques. Download the extract somewhere, and call it source, duplicate source and add your extra nodes without breaking the topology, (OSM work in topological level if i remember correctly); use that modified source version as input to OSRM.

I would suggest going manual using the right software, then as you feel confident upgrade your workflow to scripted steps.

The reason im suggesting that is you don't need the upstream osm extract for everyday use. A good scenario would be to pull the updated version once or twice every month/week depending on your needs.


You can use your own data with OSM data. Both have to be in OSM format.

From my experience: This works when you want to combine OSM and custom data for neighbour regions. Little overlap in border areas is not a problem. For example when use OSM data for Europe countries/excluding Austria/ and custom data for Austria.

  1. For your custom data -> Use Id's in upper end of possible ID's. This will prevent duplicated ID's.
  2. Merge files - your and OSM.
  3. Connect routing networks - put some fake ways -> Get node ID's both networks /OSM and custom data/.
  4. Store ways and nodes used to connect fake ways - ID, long,lat. Next time when you update data this will help to check for broken connections.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.