pyshp
2021-07-30 本文已影响0人
hehehehe
https://github.com/GeospatialPython/pyshp
iterRecords,iterShapeRecords,iterShapes,
record,records,shapeRecord,shapeRecords,
numRecords,numShapes,fields,
bbox,close,dbf,encoding,encodingErrors,
load,load_dbf,load_shp,load_shx,mbox,
shape,shapeName,
shapeType,shapeTypeName,shapes,shp,shpLength,shx,zbox
>>> r = shapefile.Reader('shapefiles/test/polygon')
>>> w = shapefile.Writer('shapefiles/test/copy')
>>> w.fields = r.fields[1:] # skip first deletion field
>>> # adding existing Shape objects
>>> for shaperec in r.iterShapeRecords():
... w.record(*shaperec.record)
... w.shape(shaperec.shape)
>>> # or GeoJSON dicts
>>> for shaperec in r.iterShapeRecords():
... w.record(*shaperec.record)
... w.shape(shaperec.shape.__geo_interface__)
>>> w.close()