本文整理汇总了Python中arcpy.ListDatasets方法的典型用法代码示例。如果您正苦于以下问题:Python arcpy.ListDatasets方法的具体用法?Python arcpy.ListDatasets怎么用?Python arcpy.ListDatasets使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类arcpy
的用法示例。
在下文中一共展示了arcpy.ListDatasets方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_feature_classes
# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import ListDatasets [as 别名]
def get_feature_classes(self):
"""Get geodatabase feature classes as ordered dicts."""
fcs = []
if self.arcpy_found:
arcpy.env.workspace = self.path
# iterate feature classes within feature datasets
fds = [fd for fd in arcpy.ListDatasets(feature_type='feature')]
if fds:
for fd in fds:
arcpy.env.workspace = os.path.join(self.path, fd)
for fc in arcpy.ListFeatureClasses():
od = self._get_fc_props(fc)
od['Feature dataset'] = fd
fcs.append(od)
# iterate feature classes in the geodatabase root
arcpy.env.workspace = self.path
for fc in arcpy.ListFeatureClasses():
od = self._get_fc_props(fc)
fcs.append(od)
else:
ds = ogr.Open(self.path, 0)
fcs_names = [
ds.GetLayerByIndex(i).GetName()
for i in range(0, ds.GetLayerCount())
if ds.GetLayerByIndex(i).GetGeometryColumn()
]
for fc_name in fcs_names:
try:
fc_instance = FeatureClassOgr(self, fc_name)
od = OrderedDict()
for k, v in GDB_FC_PROPS.items():
od[v] = getattr(fc_instance, k, '')
# custom props
od['Row count'] = fc_instance.get_row_count()
fcs.append(od)
except Exception as e:
print(e)
return fcs
# ----------------------------------------------------------------------