Skip to content

Instantly share code, notes, and snippets.

@ebrelsford
Created March 6, 2014 00:39
Show Gist options
  • Save ebrelsford/9379886 to your computer and use it in GitHub Desktop.
Save ebrelsford/9379886 to your computer and use it in GitHub Desktop.
Use ogr2ogr to get data from a PostGIS database as GeoJSON
$ ogr2ogr -f GeoJSON data.geojson \
PG:"dbname='dbname' user='dbuser' password='dbpassword' host='dbhost'" \
-sql "SELECT id, geometry from table_name where geometry is not null"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment