4

in the tutorial it is shown how to start an OSRM server with this example :

wget http://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf

osrm-extract berlin-latest.osm.pbf -p profiles/car.lua
osrm-contract berlin-latest.osrm
osrm-routed berlin-latest.osrm

I would like to start a server not only on Berlin dataset, but on a full country dataset. For instance all German country roads. Maybe there is something to do with the contract, but i don't really know what king of .osrm i should put as argument to tell it to use a larger dataset that would be the combination of several dataset.

I think the answer should be really obvious when we know it, but it still feel a bit wooly.

Thank you.

DeepProblems
  • 597
  • 4
  • 24
  • Um, well, just run it on a larger extract? What exactly is the problem? – scai Jun 26 '17 at 09:42
  • I mean i would like to use an osrm server on a custom dataset. Like maybe some parts of france, and then some parts of germany etc. Then do I have to download the full Europe extract in order to have some part of some different countries? Or maybe i can just download only the useful datasets and do something like packing together? – DeepProblems Jun 26 '17 at 12:04

2 Answers2

2

According to an OSRM issue it is not possible to merge .osrm files. However you can merge multiple PBF files before generating your .osrm files.

Merging of OSM XML or PBF files can be done with osmium:

osmium merge file1.osm.pbf file2.osm.pbf -o merged.osm.pbf.

Or with osmosis:

osmosis --rb file1.osm.pbf --rb file2.osm.pbf --m --wb merged.osm.pbf

scai
  • 20,297
  • 4
  • 56
  • 72
  • 1
    Oh, ok, That sound nice, thank you very much. That was what i was looking for. – DeepProblems Jun 26 '17 at 12:30
  • Did this tool doing dedublication of data? For example Russia is listed under both Asia and Europe, and if i want combine all region of Russia with Europe, i need to combine 2 PBF file: russia-latest.pbf and europe-latest.pbf. Both of it contain Central Federal District. Did it included in result as single entry? – Alexander Fresh Nov 12 '19 at 09:02
  • Unfortunately I can't answer that. Try it yourself or ask the OSRM developers, if there are any left. – scai Nov 12 '19 at 09:13
  • @scai, can you kindly tell me if this answer will work in my case: I have osrm server set up on ngnix, and i want to add one more country to it, should i do this. Previously i would create separate systemd services for both countries. Please do reply. – M_S_N Feb 24 '20 at 16:09
  • @M_S_N Unfortunately I can't answer this question since I've never run a OSRM server so far. – scai Feb 25 '20 at 06:44
0
wget http://download.geofabrik.de/europe/germany-latest.osm.pbf

osrm-extract germany-latest.osm.pbf -p profiles/car.lua
osrm-contract germany-latest.osrm
osrm-routed germany-latest.osrm

Should work, but please note it will require around 16GB of RAM and probably a similar amount of disk space.

EDIT:

After clarification what you will need to do is merge the .osm.pbf files using the osmium tool.

./osmium merge first.osm.pbf second.osm.pbf third.osm.pbf -o result.osm.pbf
themarex
  • 909
  • 7
  • 16
  • You are right, my example was really bad because i did not realize there was a file for full germany. Let me rephrase it.. Well, i actualy would like to pick some datasets (let's say : http://download.geofabrik.de/europe/france/champagne-ardenne.html, then http://download.geofabrik.de/europe/france/auvergne.html and finally http://download.geofabrik.de/europe/italy/centro.html) Then, do I have to download the full europe map, or can i just get those three, and pack it together in order to only use what i will need. – DeepProblems Jun 26 '17 at 12:11