arcgis使用arcpy中拆分获取FeatureClass中各类型地物要素到单独的shpfile文件
很好用,简单易懂。
arcgis使用arcpy中按字段拆分要素到单独的shpfile文件:
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26coding = 'utf-8' # -*- coding:UTF-8 -*- import os import arcpy gdbPath=r"C:UsersHPDesktopLUCCtest.gdb" #输入GDB数据库所在的文件夹的路径 FieldValue="DISTRICTID" arcpy.env.workspace = gdbPath #将数据库作为工作空间 fcs=arcpy.ListFeatureClasses() #获取所有要素类 for fc in fcs: #循环所有要素类 nums = arcpy.GetCount_management(fc).getOutput(0) # 获取该要素类个数 print(str(fc) +"要素总个数为:" + str(nums)) shpfields = [FieldValue] shp_JH = [] with arcpy.da.SearchCursor(fc, shpfields) as cursor: for shpRow in cursor: shp_JH.append(shpRow[0]) # 注意这个参数0 for selectVal in set(shp_JH): where_clause = '"' + FieldValue + '"' + '= '%s''%(str(selectVal)) districtid_FC = str(fc)+ "_" + str(selectVal) arcpy.Select_analysis(fc, districtid_FC, where_clause) print("全部完成!")
最后
以上就是坦率导师最近收集整理的关于arcgis使用arcpy中按字段拆分要素到单独的shpfile文件 很好用,简单易懂的全部内容,更多相关arcgis使用arcpy中按字段拆分要素到单独的shpfile文件内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复