Created
September 15, 2011 19:20
-
-
Save andrewjennings/1220206 to your computer and use it in GitHub Desktop.
Exporting a plan to a shapefile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This will export the plan with id 1270, called "mf_exact", to | |
# a shapefile called mf_exact.shp | |
pgsql2shp -f mf_exact -u publicmapping -P <password_here> -h <hostname> publicmapping "select d.geom, d.name, | |
from redistricting_district as d | |
join (select max(version) as latest, district_id, plan_id from redistricting_district where plan_id = 1270 group by district_id, plan_id) as v on d.district_id = v.district_id and d.plan_id = v.plan_id and d.version = v.latest | |
where not (ST_IsEmpty(d.geom) or d.district_id = 0);" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment