Skip to content

Instantly share code, notes, and snippets.

@zimmicz
Created September 21, 2016 16:38
Show Gist options
  • Save zimmicz/169c109c3e9f2a39ff9dde90e1602f30 to your computer and use it in GitHub Desktop.
Save zimmicz/169c109c3e9f2a39ff9dde90e1602f30 to your computer and use it in GitHub Desktop.
OSM2PostGIS
#!/bin/bash
wget http://download.geofabrik.de/europe/czech-republic-latest-free.shp.zip
unzip czech-republic-latest-free.shp.zip -d osm
cd osm
rename 's/gis\.//g' *.*
rename 's/osm_//g' *.*
rename 's/_free_1//g' *.*
export PG_USE_COPY=YES
for f in ./*.shp; do
echo "Loading $f..."
ogr2ogr -f "PostgreSQL" PG:"dbname=munigtc user=zimmi active_schema=osm" \
-s_srs EPSG:4326 \
-t_srs EPSG:5514 \
-lco GEOMETRY_NAME=geom \
-nlt PROMOTE_TO_MULTI \
-gt 65000 \
$f
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment