本文整理匯總了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
# ----------------------------------------------------------------------