Does osm2po support importing multiple OpenStreetMap files into the same Postgres/PostGIS database (i.e., to be used for routing)?

If yes, can the OSM files be for geographic regions that are not next to each other? For example, could I import something like NewYork.osm and SanFrancisco.osm into the same routing database?


1 Answer 1


Yes, since version 4.6.9 it's possible.

  1. Convert NewYork and SanFrancisco separately, but use cmd=tj which processes phase 1 and 2 of osm2po's conversion chain only.
  2. Don't forget to set a meaningful prefix parameter for both, e.g. prefix=ny for NewYork.
  3. Use the same tileSize parameter for everything you are going to merge.
  4. The steps above result in two directories you can transform into a third one. e.g.:

java -Xmx1g -jar osm2po-core.jar cmd=m prefix=nysf ny sf

where cmd=m is the merge command and ny and sf the source directories (paths). You can even use wildcards here, but I do not recommend it.

Finally proceed with the merged directory and call phase 3 and 4 with

cmd=sp prefix=nysf.

By the way, there is no difference whether the regions intersect or not. You can even merge NewYork-Detailed, SanFrancisco-Detailed and US-Motorways-Only or sth. like that.

  • 1
    Thank you very much for not just answering 'yes', but explaining how it can be done! Greatly appreciated.
    – clint
    Commented Sep 7, 2013 at 9:26
  • Merging creates *.2po files under newly created directory nysf. How can I import those files into database? Or how can I generate SQL like previously for each country?
    – lubosdz
    Commented Jul 1, 2022 at 22:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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