Skip to content

Instantly share code, notes, and snippets.

@mojodna
Created May 19, 2013 21:05
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mojodna/5609010 to your computer and use it in GitHub Desktop.
Save mojodna/5609010 to your computer and use it in GitHub Desktop.
Importing Natural Earth into PostGIS w/ ogr2ogr
P900913="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"
EXTENT="-180 -85.05112878 180 85.05112878"
ogr2ogr --config PG_USE_COPY YES --config OGR_ENABLE_PARTIAL_REPROJECTION TRUE --config SHAPE_ENCODING WINDOWS-1252 -t_srs "$P900913" -lco ENCODING=UTF-8 -lco SRID=900913 -clipsrc $EXTENT -segmentize 1 -skipfailures -f PGDump /vsistdout/ ne_10m_populated_places.shp | pv | psql -d natural_earth -q
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment