Beispiel #1
0
nidextractor = NIDExtractor(NID)

# extract the data to a new shapefile

nidextractor.extract_shapefile(sfile, damfile)

# the extractor can also extract data to a new shapefile using a bounding box

bbox = -78, 38, -75, 40

# output file name

bboxfile = 'bbox'

nidextractor.extract_bbox(bbox, bboxfile)

# let's use pyshp to open up the patuxent shapefile and get some info about the
# dams that we downloaded

from shapefile import Reader

sf = Reader(damfile)

# these are the attributes of each dam stored in the NID

name_index = sf.fields.index(['DAM_NAME', 'C', 65, 0]) - 1
nid_index = sf.fields.index(['NIDID', 'C', 7, 0]) - 1
lon_index = sf.fields.index(['LONGITUDE', 'N', 19, 11]) - 1
lat_index = sf.fields.index(['LATITUDE', 'N', 19, 11]) - 1
river_index = sf.fields.index(['RIVER', 'C', 65, 0]) - 1
Beispiel #2
0
nidextractor = NIDExtractor(NID)

# extract the data to a new shapefile

nidextractor.extract_shapefile(sfile, damfile)

# the extractor can also extract data to a new shapefile using a bounding box 

bbox = -78, 38, -75, 40

# output file name

bboxfile = 'bbox'

nidextractor.extract_bbox(bbox, bboxfile)

# let's use pyshp to open up the patuxent shapefile and get some info about the
# dams that we downloaded

from shapefile import Reader

sf = Reader(damfile)

# these are the attributes of each dam stored in the NID

name_index  = sf.fields.index(['DAM_NAME',   'C', 65,   0]) - 1
nid_index   = sf.fields.index(['NIDID',      'C', 7,    0]) - 1
lon_index   = sf.fields.index(['LONGITUDE',  'N', 19,  11]) - 1
lat_index   = sf.fields.index(['LATITUDE',   'N', 19,  11]) - 1
river_index = sf.fields.index(['RIVER',      'C', 65,   0]) - 1