-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add dumper of flowpaths to shapefile
- Loading branch information
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
"""Dump flowpaths to a shapefile.""" | ||
|
||
from geopandas import read_postgis | ||
from pyiem.util import get_dbconn | ||
|
||
|
||
def main(): | ||
"""Go Main Go.""" | ||
pgconn = get_dbconn('idep') | ||
df = read_postgis(""" | ||
SELECT f.fpath, f.huc_12, ST_Transform(f.geom, 4326) as geo from | ||
flowpaths f, huc12 h WHERE h.scenario = 0 and f.scenario = 0 | ||
and h.huc_12 = f.huc_12 and h.states ~* 'IA' | ||
""", pgconn, index_col=None, geom_col='geo') | ||
df.to_file("ia_flowpaths.shp") | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |