I have a few (~50) PBF files came from SRTM conversion using phyghtmap.
How to merge all of them before importing with osm2pgsql?
You can use osmium for merging:
osmium merge file1.osm file2.osm -o merged.osm
.
Alternatively try osmosis:
osmosis --rx file1.osm --rx file2.osm --merge --wx merged.osm
Note that osmosis has a weird syntax and you need to specify the --merge
commands n-1
times for merging n
files.
omium merge file*.osm -o merged.osm
.
merge
option. : osmcode.org/osmium-tool/manual.html#command-line-completion
osmosis --rb file1.osm --rb file2.osm --merge --wb merged.osm
. rx
is for XML files.
On Ubuntu:
sudo apt-get install osmium-tool
osmium cat new-york.osm.pbf new-jersey.osm.pbf connecticut.osm.pbf -o ny-nj-ct.osm.pbf
>> osmium --version
``` osmium version 1.16.0 libosmium version 2.20.0 Supported PBF compression types: none zlib lz4```
osmium cat
is often not what you want, take a look at osmium merge
instead!
osmconvert did trick for me on windows for two files.
osmconvert a.pbf --out-o5m | osmconvert - b.pbf -o=all.pbf