I'm working with multiple pbf files (one per administrative region). I thought I would import them one by one in postgis, with:

osm2pgsql --proj 4326 --hstore-all --database gis first.pbf --style custom.style --slim --flat-nodes osm2pgsql.flatnodes --create
for file in other_pbfs; do 
    osm2pgsql --proj 4326 --hstore-all --database gis $file.pbf --style custom.style --slim --flat-nodes osm2pgsql.flatnodes --append

However, the first import (--create) is going quite fast:

Processing: Node(262182k 1691.5k/s) Way(38130k 125.43k/s) Relation(0 0.00/s)

While the second one (--append) is going… super slow:

Processing: Node(13k 2.5k/s) Way(0 0.00/s) Relation(0 0.00/s)

If I merge these two PBFs before import (osmium merge *.pbf -o output.pbf), it goes fast again but I'd like to remove that unnecessary step if possible?

I tried with different formats (.pbf, .osm, …) but there is no changes in speed results.

  • 2
    did it even finish with --append?? ...that mode is solely for updating existing data with the proper diff files (.osc) provided by e.g. Geofabrik. it is simply not meant to add data...merging your data prior to the import is the best way to go here I'm afraid... – ThingumaBob Aug 27 '18 at 11:33
  • no it indeed never finished… But if it's only for merging diff files... I guess that's the reason :). – bagage Aug 27 '18 at 12:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.