After read this How merge osm files with same ID objects? I can't get any conclusion so please don't flag as duplicate.

I have some PBF files came from NASA SRTM ( http://katze.tfiu.de/projects/phyghtmap/phyghtmap.1.html )

My problem is phyghtmap have its own ID numbers and I believe start from same number in every PBF file.

I need to import these PBF files to my database (appart from OSM tables so official OSM ID is not a problem) using osm2pgsql.

For each HGT file I have a PBF and its own ID range that will conflict with the next files and override previous data in database.

How can I import all these files incrementing the ID for every file?

Tools I have: osmosis, osm2pgsql, osmium and phyghtmap.

  • Can you explain what you are trying to do with the data? I don't have a solution for the ID issue (except maybe writing a plugin for osmosis), but maybe there is a better way to combine your SRTM data? Do you have GDAL/OGR?
    – BradHards
    Commented Jul 27, 2017 at 2:56
  • To create a layer in my Geoserver with level contours... The source is the SRTM DEM files (GeoTIFF) came in tiles. The phyghtmap program convert HGT to PBF and then I use osm2pgsql to import them to my database.
    – Magno C
    Commented Jul 27, 2017 at 10:54
  • About GDAL/OGR : Tell me what you have in mind and I'll try to do it.
    – Magno C
    Commented Jul 27, 2017 at 10:59
  • Already tried osmium merge --verbose *.osm.pbf -o merged.osm.pbf --overwrite but seems does not work. All PBF are sorted.
    – Magno C
    Commented Jul 27, 2017 at 11:02
  • @BradHards are you the dev of osmium, osmosis or osm2pgsql ? Can I suggest a kind of --re-index parameter to create new osm_id based on the "max" ID in database? For osm2pgsql we have --create (truncate and insert new data) and --append (update and insert new if not exists). We need something to renumber the new ID to avoid conflict (not edit, update or override but force append). Same for osmium when merging.
    – Magno C
    Commented Jul 27, 2017 at 11:17

1 Answer 1


Solved by merging all HGT into a single TIFF and then convert it to PBF.

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.