HowTo:  Automate the export of rasters from an SDE raster catalog

相关信息
Article ID: 40988
Software:
ArcGIS - ArcInfo 10
ArcGIS for Desktop Advanced 10.1
ArcGIS for Desktop Standard 10.1
Platforms:
Windows Server 2003, Vista, Server 2008, Windows 7, Windows 8

问题描述
GIS managers and administrators sometimes need to automate the process of exporting rasters from SDE raster catalogs to raster datasets on disk. Instructions provided describe how to do this.
已邀请:

EsriSupport

赞同来自:

解决方案
The below Python script demonstrates how to automate the export of raster datasets from an SDE raster catalog to a raster dataset on disk. The background value is also set to zero in the below script.
1. Modify the parameters below according to the environment:
workspace = r"Database Connections\lclinton2_SQL08_R2.sde\sde101.SDE.Prasanta"
outras = r"C:\Data\outrasters"

2.

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)


创建及修改时间
Created: 3/15/2013

Last Modified: 8/5/2013
原文链接
http://support.esri.com/en/kno ... 40988

要回复问题请先登录注册