May 2017
Beginner to intermediate
328 pages
7h 17m
English
We have already learned how to export SHP from PostGIS. We'll use SHP as the output format again, this time to show how to export a subset of data using ogr2ogr and how to re-project it during the export:
ogr2ogr -f "ESRI Shapefile" ne_coastline_islands PG:"host=localhost port=5434 user=postgres dbname=mastering_postgis" -t_srs EPSG:3857 -where "scalerank=1" data_import.ne_coastline
The preceding command extracts the islands off the 110M Natural Earth Coastline dataset, transforms it to EPSG 3857 (aka 900913), and exports the data as a shapefile. It is worth noting that because the shapefile is a format that is made up of a few files, the files were exported to a directory named ne_coastline_islands, and the file names are ...
Read now
Unlock full access