Skip to content

Instantly share code, notes, and snippets.

@springmeyer
Created November 1, 2010 07:23
Show Gist options
  • Save springmeyer/657772 to your computer and use it in GitHub Desktop.
Save springmeyer/657772 to your computer and use it in GitHub Desktop.

Revisions

  1. springmeyer created this gist Nov 1, 2010.
    19 changes: 19 additions & 0 deletions osm.pbf to postgis
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    # 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> -