Arcpy基础入门-6、遍历

来源:互联网 发布:开发java最好用的软件 编辑:程序博客网 时间:2024/05/04 19:39

1、列出所有的要素类

import arcpyarcpy.env.workspace = "D:\用户目录\Documents\ArcGIS\可达性分析成果.gdb"# Use Python's built-in function len to reveal the number of feature classes#   in the workspacefcs = arcpy.ListFeatureClasses()fcCount = len(fcs)for fc in fcs:     # Copy the features from the workspace to a folder    #    print fc    print fcCount

2、列出所有的数据集

import arcpyarcpy.env.workspace = "D:\数据备份.gdb"ds = arcpy.ListDatasets()dsCount = len(ds)for dataset in ds:   print datasetprint dsCount

3、列出文件下所有的文件

import arcpyarcpy.env.workspace = "E:\KuGou"# Use Python's built-in function len to reveal the number of feature classes#   in the workspacefiles = arcpy.ListFiles()fcCount = len(files)for fc in files:     # Copy the features from the workspace to a folder    #    print fc    print fcCount

4、列出所有的栅格文件

import arcpyimport arcpy.saarcpy.env.workspace = "E:\LE71230392003097EDC00"# Use Python's built-in function len to reveal the number of feature classes#   in the workspacerasterlist = arcpy.ListRasters()fcCount = len(rasterlist)for fc in rasterlist:     # Copy the features from the workspace to a folder    #    print fc    print fcCount



1 0
原创粉丝点击