Created
February 27, 2015 08:56
-
-
Save trolleway/6017b3a23729afd9d8d3 to your computer and use it in GitHub Desktop.
Выгрузка границ стран из дампа планеты OSM
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
#!/bin/bash | |
#выгрузить границы из OSM | |
#выгрузка границ стран из дампа планеты | |
#osmosis --read-pbf file=source/planet-latest.osm.pbf --tf accept-ways admin_level=2 --used-node --tf accept-relations admin_level=2 --write-pbf extracts/boundaries.osm.pbf | |
#./osmconvert source/planet-latest.osm.pbf -o=source/planet-latest.o5m | |
echo "Start step 1" | |
#time ./osmfilter32 source/planet-latest.o5m --keep= --keep-relations="admin_level=2" --out-o5m >extracts/admin_level2.o5m | |
#выгрузка точек городов - столиц стран | |
echo "Filter places" | |
time ./osmfilter32 source/planet-latest.o5m --keep="place=city" --drop-ways --ignore-dependencies --out-o5m >extracts/places.o5m | |
echo "Filter boundaries" | |
time ./osmfilter32 source/planet-latest.o5m --keep-nodes= --keep-ways-relations="boundary=administrative AND admin_level=2" --drop="admin_level=3 =4 =5 =6" --out-o5m >extracts/boundaries.o5m | |
#конвертация из o5m в pbf, для возможности загрузки в PostGIS | |
echo "Start convert to pbf" | |
time ./osmconvert32 extracts/places.o5m -o=extracts/places.osm.pbf | |
time ./osmconvert32 extracts/boundaries.o5m -o=extracts/boundaries.osm.pbf | |
#time ./osmconvert32 extracts/admin_level2.o5m -o=extracts/admin_level2.osm.pbf | |
#time ./osmconvert32 extracts/city500k.o5m -o=extracts/city500k.osm.pbf | |
#Загрузка в локальную базу PostGIS | |
psql -U trolleway -d gis -c "DROP TABLE planet_osm_line;" | |
psql -U trolleway -d gis -c "DROP TABLE planet_osm_point;" | |
psql -U trolleway -d gis -c "DROP TABLE planet_osm_polygon;" | |
psql -U trolleway -d gis -c "DROP TABLE planet_osm_roads;" | |
osm2pgsql --create --multi-geometry --database gis --username trolleway boundaries.osm.pbf | |
echo "End of script" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment