Skip to content

Instantly share code, notes, and snippets.

@mhkeller
Last active December 23, 2015 05:49
Show Gist options
  • Select an option

  • Save mhkeller/6590111 to your computer and use it in GitHub Desktop.

Select an option

Save mhkeller/6590111 to your computer and use it in GitHub Desktop.
PostGis query to shp
$ pgsql2shp -f <path to output shapefile> -h <hostname> -u <username> -P <password> databasename "<query>"
$ pgsql2shp -f ca_hex_2000_ided.shp -h localhost -u mike mike "SELECT ca_hex_2000_ided.geom, ca_hex_2000_ided.hex_id FROM ca_hex_2000_ided, bounder WHERE ST_Intersects(ca_hex_2000_ided.geom, bounder.geom) "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment