Skip to content

Instantly share code, notes, and snippets.

@TimSC
Created October 15, 2015 23:31
Show Gist options
  • Select an option

  • Save TimSC/f5d36a302cf2311b7bdc to your computer and use it in GitHub Desktop.

Select an option

Save TimSC/f5d36a302cf2311b7bdc to your computer and use it in GitHub Desktop.
Useful osm/osmosis import commands
sudo -u postgres createuser gisuser
sudo -u postgres dropdb egypt-osm
sudo -u postgres createdb --encoding=UTF8 --owner=gisuser egypt-osm
sudo pluma /etc/postgresql/9.3/main/pg_hba.conf
change to use md5 authentication for local connections
sudo service postgresql restart
sudo -u postgres psql --dbname=egypt-osm -c "CREATE EXTENSION postgis;"
sudo -u postgres psql --dbname=egypt-osm -c "CREATE EXTENSION hstore;"
sudo -u postgres psql --dbname=egypt-osm -c "ALTER USER gisuser WITH PASSWORD '<newpassword>';"
psql --user=gisuser --password --dbname=egypt-osm -f /usr/share/doc/osmosis/examples/pgsnapshot_schema_0.6.sql
psql --user=gisuser --password --dbname=egypt-osm -f /usr/share/doc/osmosis/examples/pgsnapshot_schema_0.6_linestring.sql
Edit ~/.osmosis and add
JAVACMD_OPTIONS=-server
JAVACMD_OPTIONS=-Xmx17G
Osmosis in debian repos is old and has bugs. Use version from the official site.
osmosis --read-pbf EG.pbf --log-progress --write-pgsql database=egypt-osm user=gisuser password='test0199'
/home/tim/osm/osmosis/bin/osmosis --read-pgsql database=egypt-osm user=gisuser password='test0199' outPipe.0=pg --dataset-bounding-box inPipe.0=pg top=30.1332509 left=31.1400604 bottom=29.9400604 right=31.3220215 outPipe.0=dd --write-xml inPipe.0=dd file=- | bzip2 > cairo.osm.bz2
/home/tim/osm/osmosis/bin/osmosis --read-pgsql database=egypt-osm user=gisuser password='test0199' outPipe.0=pg --dd inPipe.0=pg outPipe.0=dd --write-xml inPipe.0=dd file=- | bzip2 > everything.osm.bz2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment