Last active
July 30, 2019 07:33
-
-
Save dlau/6774515 to your computer and use it in GitHub Desktop.
load planet.osm admin boundaries into postgres
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: set accordingly | |
export PATH=$PATH:/users/daryl/dev/gis/osmosis/package/bin | |
note: is space delimited | |
export JAVACMD_OPTIONS="-Xmx5G -Djava.io.tmpdir=/Volumes/1TBHD0/tmp" | |
osmosis \ | |
--read-pbf planet-latest.osm.pbf \ | |
--tf accept-nodes "boundary=administrative" \ | |
--tf reject-relations \ | |
--tf reject-ways \ | |
--write-pbf file=nodes.pbf | |
osmosis \ | |
--read-pbf planet-latest.osm.pbf \ | |
--tf accept-ways "boundary=administrative" \ | |
--tf reject-relations \ | |
--used-node \ | |
--write-pbf file=ways.pbf | |
osmosis \ | |
--read-pbf planet-latest.osm.pbf \ | |
--tf accept-relations "boundary=administrative" \ | |
--used-node \ | |
--used-way \ | |
--write-pbf file=relations.pbf | |
osmosis --rb nodes.pbf outPipe.0=N --rb ways.pbf outPipe.0=W --rb relations.pbf outPipe.0=R --merge inPipe.0=N inPipe.1=W outPipe.0=NW --merge inPipe.0=NW inPipe.1=R outPipe.0=NWR --wb inPipe.0=NWR file=boundaries.pbf | |
then import boundaries.pbf | |
notes: | |
may be possible with tee | |
had issues directly writing to postgres from pipe, so had to dump to a pbf first | |
based on source: https://lists.openstreetmap.org/pipermail/dev/2011-April/022394.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment