This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Merging two or more Geographical Areas to import two or more osm files in Nominatim

1

I have installed nominatim for Maldives and now I want to install for Sri Lanka in the same db. According to lonvia i found it is fast that i merge below both files and then do the import.

I have sri-lanka-latest.osm.pbf and maldives-latest.osm.pbf two pbf files and i tried to merge these two with osmconvert command. I have read Osmconvert in the wiki and osm help questions but could not find the answer.

Then i converted these two files to .o5m files separately using osmconvert and then merged those both files. Is that what I should do?

Thanks in Advance.

asked 25 Mar '16, 09:54

Tharaka%20Rajith's gravatar image

Tharaka Rajith
26235
accept rate: 0%

edited 28 Mar '16, 08:08


3 Answers:

7

Merging two PBF files can be done in one run, using concatenated processes:

osmconvert region1.pbf --out-o5m | osmconvert - region2.pbf -o=all.pbf

Further examples and explanations can be found at OSM Wiki page:

https://wiki.openstreetmap.org/wiki/Osmconvert#Parallel_Processing

answered 26 Mar '16, 07:57

Marqqs's gravatar image

Marqqs
448510
accept rate: 22%

Even better, thanks. I added a link from the Nominatim documentation to this thread.

(27 Mar '16, 19:08) mtmail
2

this is the answer i was looking for, works like a charm, thanks

(28 Mar '16, 07:12) Tharaka Rajith

4

This should work:

  1. osmconvert country1.osm.pbf -o=country1.o5m
  2. osmconvert country2.osm.pbf -o=country2.o5m
  3. osmconvert country1.o5m country2.o5m -o=together.o5m
  4. osmconvert together.o5m -o=together.osm.pbf

and then import together.osm.pbf with Nominatim.

answered 25 Mar '16, 15:27

mtmail's gravatar image

mtmail
4.8k1574
accept rate: 27%

If you want to merge more than one file, the most voted option isn't really working for me. It only stores the content of the last 2 files.

You could make this shorter by converting all your .osm.pbf to .o5m and then do osmconvert *.o5m -o=together.osm.pbf so it gets all .o5m files.

(30 Nov '18, 13:36) xarly89

This answer should be treated with more love!:)

(03 Dec '19, 15:14) CuriosityBeg...

4

Or you can use osmium-tool:

osmium merge country1.osm.pbf country2.osm.pbf -o together.osm.pbf.

answered 25 May '17, 07:11

Jochen%20Topf's gravatar image

Jochen Topf
5.2k55074
accept rate: 31%

Source code available on GitHub .