123456789101112131415161718 |
- import fiona
- shpPath = r'D:\Users\Desktop\新建文件夹\20250407410320\导出部标错误\shp\bb_error.shp'
- # with fiona.open(shpPath, encoding='utf-8') as shp:
- # print(shp.encoding)
- # print('shp的字段信息')
- # fields = shp.schema['properties']
- #
- # # 遍历字段信息
- # for k, v in fields.items():
- # print(f'{k}->{v}')
- # # 遍历要素信息
- # for x in shp:
- # print(x)
- with fiona.Collection(shpPath) as shp:
- for feature in shp:
- print(feature['geometry']) #读取图形
- print(feature['properties']['XZQMC']) #读取属性
|