# 需要导入模块: import arcpy [as 别名]# 或者: from arcpy importListFeatureClasses[as 别名]defgetFC(ws, fc_name, fds=""):fc_list = arcpy.ListFeatureClasses("*"+ fc_name, feature_dataset=fds)ifnotfc_list: fc =""arcpy.AddWarning(fc_name +" not found in "+ ws +".")else: fc ...
arcpy.env.workspace='G:/exercise data/listtest.gdb'datasets=arcpy.ListDatasets(feature_type='feature')datasets=['']+datasetsifdatasets is not Noneelse[]fordsindatasets:forfcinarcpy.ListFeatureClasses(feature_dataset=ds):p=os.path.join(arcpy.env.workspace,ds,fc)print(p) 输出结果如下所示: 2....
ListFeatureClasses 列出工作空间中的要素类,受名称、要素类型和可选要素数据集的限制。 ListFeatureClasses({wild_card}, {feature_type}, {feature_dataset}) ◈ featrue_type:Point、Polygon、Polyline等,默认 All。 ◈ 举例: featureclasses = arcpy.ListFeatureClasses() for fc in featureclasses: arcpy.C...
arcpy.env.workspace=r'E:\test\Data80.gdb'fes= arcpy.ListFeatureClasses(feature_dataset='RG')forfcinfes:iffc==ur'小区面': with arcpy.da.UpdateCursor(fc,["Name","P3"]) as cursor:forrowincursor: courtname=row[0]ifcourts.has_key(courtname): row[1] =courts[courtname] cursor.updateRow(...
ListFeatureClasses({wild_card}, {feature_type}, {feature_dataset}) ◈featrue_type:Point、Polygon、Polyline等,默认 All。 ◈ 举例: featureclasses=arcpy.ListFeatureClasses() forfcinfeatureclasses: arcpy.CopyFeatures_management(fc,os.path.join("c:/base/output.gdb",os.path.splitext(fc)[0]))...
arcpy.env.workspace = os.path.join(self.path, fd)forfcinarcpy.ListFeatureClasses(): od = self._get_fc_props(fc) od['Feature dataset'] = fd fcs.append(od)# iterate feature classes in the geodatabase rootarcpy.env.workspace = self.pathforfcinarcpy.ListFeatureClasses(): ...
ListDatasets(wild_card, feature_type) 返回工作空间中数据集的列表; ListFeatureClasses(wild_card, feature_type, feature_dataset) 返回工作空间中矢量文件的列表。 wild_card 表示通配符,这些函数可以直接搜寻工作空间中有没有相应类型以及与通配符相匹配的文件,然后以...
for fc in arcpy.ListFeatureClasses("", "All", dataset): feature_classes.append(fc) # Print the list of feature classes for fc in feature_classes: print(fc) In this example, we first set the workspace to the File Geodatabase using thearcpy.env.workspacefunction. We then use thearcpy....
ListFeatureClasses() for fc in ftClasses: outputFt = arcpy.ValidateTableName(fc) print(outputFt) 2、访问地理数据 2.1、检查数据是否存在 Exists(dataset)函数用于检查数据是否存在。 (1)检查GDB中的图层是否存在 arcpy.env.workspace = "d:/St_Johns/data.gdb" fc = "roads" if arcpy.Exists(fc):...
ListDatasets(feature_type='feature') datasets = [''] + datasets if datasets is not None else [] # datasets为数据集Polyline,我们通过遍历查询此数据集内部的要素 for ds in datasets: for fc in arcpy.ListFeatureClasses(feature_dataset=ds): path = os.path.join(arcpy.env.workspace, ds, ...