Created
November 1, 2010 07:23
-
-
Save springmeyer/657772 to your computer and use it in GitHub Desktop.
import a pbf file into postgis from geofabrik using osmosis and osm2pgsql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# note: there is work afoot to load pbf directly with osm2pgsql | |
# http://lists.openstreetmap.org/pipermail/dev/2010-October/020953.html | |
# but for now osmosis >= 0.37 works best | |
# install java/osmosis if you don't already have it | |
sudo apt-get install sun-java6-jre | |
wget http://bretth.dev.openstreetmap.org/osmosis-build/osmosis-0.37.zip | |
unzip osmosis-0.37.zip | |
cd osmosis-0.37 | |
chmod +x bin/osmosis | |
cd bin | |
export PATH=`pwd`:$PATH | |
# grab a pbf | |
# region graphic: http://en.wikipedia.org/wiki/File:Census_Regions_and_Divisions.PNG | |
wget wget http://download.geofabrik.de/osm/north-america/us-south.osm.pbf | |
# read with osmosis and stream into osm2pgsql, note '-' arg to both | |
osmosis --read-bin us-south.osm.pbf --write-xml - | osm2pgsql --slim -d <dbname> - |
Ran across this and seems a bit old, just want to mention it seems that pbf files can now be loaded directly with osm2pgsql. No need for osmosis installation.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There is an additional wget In the line 16, moreover, it works just perfect, thanks.