操作方法
GIS 管理者和管理员有时需要自动执行将栅格从地理数据库栅格目录导出到磁盘上的栅格数据集的过程。 提供的说明介绍了如何执行此操作。
workspace = r"Database Connections\lclinton2_SQL08_R2.sde\sde101.SDE.Prasanta" outras = r"C:\Data\outrasters"
代码: import arcpy, os, string def ExtractRasterFromRC(workspace,outras): count = arcpy.GetCount_management(workspace) str_cnt = str(count) int_cnt = int(str_cnt) cnt = 1 while cnt <= int_cnt: raster = workspace + os.sep + "Raster.OBJECTID=" + str(cnt) name = "tiff_" + str(cnt) + ".tif" name_out = outras + os.sep + name print ("Reading {0}".format(raster)) arcpy.CopyRaster_management(raster,name_out,"DEFAULTS","0","0","","","8_BIT_UNSIGNED") print ("Copied {0}".format(name_out)) cnt += 1 if __name__=="__main__": workspace = r"Database Connections\lclinton2_SQL08_R2.sde\sde101.SDE.Prasanta" outras = r"C:\Data\outrasters" ExtractRasterFromRC(workspace,outras)
获取来自 ArcGIS 专家的帮助
下载 Esri 支持应用程序