Skip to main content
deleted 69 characters in body
Source Link
Kadir Şahbaz
  • 78k
  • 57
  • 257
  • 404

Somewhat related issue I faced recently, needed two pbfs in the same database so the way I did it is:

load your "first pbf" as you normally would into postgres

  • load your "first pbf" as you normally would into postgres
createdb test-U user
psql -U user -d test-c 'CREATE EXTENSION hstore;'
psql -U user -d test-c 'CREATE EXTENSION postgis;'
psql -U user -d test-c 'CREATE SCHEMA osm_public;'
psql -U user -d test-f /usr/share/doc/osmosis/examples/pgsnapshot_schema_0.6.sql
psql -U user -d test-f /usr/share/doc/osmosis/examples/pgsnapshot_schema_0.6_linestring.sql

load your pbf with

osmosis -v --rbf myarea.osm.pbf --wp host=localhost database=test user=user
  • load your pbf with

-- alter existing schemaosmosis -v --rbf myarea.osm.pbf --wp host=localhost database=test user=user

  • alter existing schema
psql -U user -d test -c 'ALTER TABLE nodes SET SCHEMA osm_public;'
psql -U user -d test -c 'ALTER TABLE relation_members SET SCHEMA osm_public;'
psql -U user -d test -c 'ALTER TABLE relations SET SCHEMA osm_public;'
psql -U user -d test -c 'ALTER TABLE users SET SCHEMA osm_public;'
psql -U user -d test -c 'ALTER TABLE way_nodes SET SCHEMA osm_public;'
psql -U user -d test -c 'ALTER TABLE ways SET SCHEMA osm_public;'
psql -U user -d test -f /usr/share/doc/osmosis/examples/pgsnapshot_schema_0.6.sql
psql -U user -d test -f /usr/share/doc/osmosis/examples/pgsnapshot_schema_0.6_linestring.sql
  • and load your other pbf

and load your other pbfosmosis -v --rbf latest.osm.pbf --wp host=localhost database=test user=user

osmosis -v --rbf latest.osm.pbf --wp host=localhost database=test user=user

youYou now have a pbf in public, and one in osm_public

Hope this will be helpful for someone.

Somewhat related issue I faced recently, needed two pbfs in the same database so the way I did it is:

load your "first pbf" as you normally would into postgres

createdb test-U user
psql -U user -d test-c 'CREATE EXTENSION hstore;'
psql -U user -d test-c 'CREATE EXTENSION postgis;'
psql -U user -d test-c 'CREATE SCHEMA osm_public;'
psql -U user -d test-f /usr/share/doc/osmosis/examples/pgsnapshot_schema_0.6.sql
psql -U user -d test-f /usr/share/doc/osmosis/examples/pgsnapshot_schema_0.6_linestring.sql

load your pbf with

osmosis -v --rbf myarea.osm.pbf --wp host=localhost database=test user=user

-- alter existing schema

psql -U user -d test -c 'ALTER TABLE nodes SET SCHEMA osm_public;'
psql -U user -d test -c 'ALTER TABLE relation_members SET SCHEMA osm_public;'
psql -U user -d test -c 'ALTER TABLE relations SET SCHEMA osm_public;'
psql -U user -d test -c 'ALTER TABLE users SET SCHEMA osm_public;'
psql -U user -d test -c 'ALTER TABLE way_nodes SET SCHEMA osm_public;'
psql -U user -d test -c 'ALTER TABLE ways SET SCHEMA osm_public;'
psql -U user -d test -f /usr/share/doc/osmosis/examples/pgsnapshot_schema_0.6.sql
psql -U user -d test -f /usr/share/doc/osmosis/examples/pgsnapshot_schema_0.6_linestring.sql

and load your other pbf

osmosis -v --rbf latest.osm.pbf --wp host=localhost database=test user=user

you now have a pbf in public, and one in osm_public

Hope this will be helpful for someone

Somewhat related issue I faced recently, needed two pbfs in the same database so the way I did it is:

  • load your "first pbf" as you normally would into postgres
createdb test-U user
psql -U user -d test-c 'CREATE EXTENSION hstore;'
psql -U user -d test-c 'CREATE EXTENSION postgis;'
psql -U user -d test-c 'CREATE SCHEMA osm_public;'
psql -U user -d test-f /usr/share/doc/osmosis/examples/pgsnapshot_schema_0.6.sql
psql -U user -d test-f /usr/share/doc/osmosis/examples/pgsnapshot_schema_0.6_linestring.sql
  • load your pbf with

osmosis -v --rbf myarea.osm.pbf --wp host=localhost database=test user=user

  • alter existing schema
psql -U user -d test -c 'ALTER TABLE nodes SET SCHEMA osm_public;'
psql -U user -d test -c 'ALTER TABLE relation_members SET SCHEMA osm_public;'
psql -U user -d test -c 'ALTER TABLE relations SET SCHEMA osm_public;'
psql -U user -d test -c 'ALTER TABLE users SET SCHEMA osm_public;'
psql -U user -d test -c 'ALTER TABLE way_nodes SET SCHEMA osm_public;'
psql -U user -d test -c 'ALTER TABLE ways SET SCHEMA osm_public;'
psql -U user -d test -f /usr/share/doc/osmosis/examples/pgsnapshot_schema_0.6.sql
psql -U user -d test -f /usr/share/doc/osmosis/examples/pgsnapshot_schema_0.6_linestring.sql
  • and load your other pbf

osmosis -v --rbf latest.osm.pbf --wp host=localhost database=test user=user

You now have a pbf in public, and one in osm_public.

Source Link

Somewhat related issue I faced recently, needed two pbfs in the same database so the way I did it is:

load your "first pbf" as you normally would into postgres

createdb test-U user
psql -U user -d test-c 'CREATE EXTENSION hstore;'
psql -U user -d test-c 'CREATE EXTENSION postgis;'
psql -U user -d test-c 'CREATE SCHEMA osm_public;'
psql -U user -d test-f /usr/share/doc/osmosis/examples/pgsnapshot_schema_0.6.sql
psql -U user -d test-f /usr/share/doc/osmosis/examples/pgsnapshot_schema_0.6_linestring.sql

load your pbf with

osmosis -v --rbf myarea.osm.pbf --wp host=localhost database=test user=user

-- alter existing schema

psql -U user -d test -c 'ALTER TABLE nodes SET SCHEMA osm_public;'
psql -U user -d test -c 'ALTER TABLE relation_members SET SCHEMA osm_public;'
psql -U user -d test -c 'ALTER TABLE relations SET SCHEMA osm_public;'
psql -U user -d test -c 'ALTER TABLE users SET SCHEMA osm_public;'
psql -U user -d test -c 'ALTER TABLE way_nodes SET SCHEMA osm_public;'
psql -U user -d test -c 'ALTER TABLE ways SET SCHEMA osm_public;'
psql -U user -d test -f /usr/share/doc/osmosis/examples/pgsnapshot_schema_0.6.sql
psql -U user -d test -f /usr/share/doc/osmosis/examples/pgsnapshot_schema_0.6_linestring.sql

and load your other pbf

osmosis -v --rbf latest.osm.pbf --wp host=localhost database=test user=user

you now have a pbf in public, and one in osm_public

Hope this will be helpful for someone