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

Merge two files .osm.bz2

1

Hello, i installed my own overpass API server. Today i only work with French country data and everything is ok. I would like to add the Canada but i don't know how to do that. I tried to merge two .osm files with osmconvert64 but i've got an error : unexpected end of file in france-latest.osm. Do you have a good method to do that ?

Thanks for all

Mathieu

asked 31 May '17, 08:10

mdk83's gravatar image

mdk83
25224
accept rate: 0%

Hello guys, sorry for my late answer but i couldn't test before. Thank you very much for your answer it works wonderfully !!

thank you for everything !

Mathieu

(01 Aug '17, 18:21) mdk83

2 Answers:

1

Osmium can merge two OSM files: osmium merge file1.osm file2.osm -o merged.osm. Osmium can read and write any OSM file format. I recommend you use PBF format for best performance. Make sure to use files that are extracted from the same planet file (for instance Geofabrik extracts). Do not use files from different points in time, otherwise you might get wierd effects.

answered 01 Jun '17, 06:58

Jochen%20Topf's gravatar image

Jochen Topf
5.2k55074
accept rate: 31%

1

In your specific use case, you could also just import one file after another into the same directory, i.e. run

bunzip2 <$FIRST_FILE | $EXEC_DIR/bin/update_database --db-dir=$DB_DIR/ --meta
bunzip2 <$SECOND_FILE | $EXEC_DIR/bin/update_database --db-dir=$DB_DIR/ --meta

If there is conflicting data then the data from the last file wins.

answered 02 Jun '17, 06:52

Roland%20Olbricht's gravatar image

Roland Olbricht
6.7k36489
accept rate: 36%

Source code available on GitHub .