arcpy 批量读取文件夹下所有shp文件的属性
包括属性表数据
中心点经纬度
上下左右经纬度 Xmin,Xmax,Ymin,Ymax
def get_property_sheet(shp_path):
"""
:param inshp: 输入的shp文件
:return:
"""
try:
for infiles in os.listdir(shp_path):
inshp = shp_path + infiles
if inshp[-4:] == '.shp':
print inshp
# 获取shp文件的属性表数据
cond = ['NAME2004','AD2004','SHAPE@X', 'SHAPE@Y']
with arcpy.da.SearchCursor(inshp, cond) as cursor:
for row in cursor:
result = row
# 讀取上下左右的經緯度最大最小值
with arcpy.da.SearchCursor(inshp, 'SHAPE@') as cursor:
for row in cursor:
resultcode = row[0].extent
resultcode = str(resultcode).