Python 实现ARCGIS中raster to ascii


import arcpy
from arcpy import env
from arcpy.sa import *
import os
import os.path
import sys

arcpy.env.workspace = "E:\\xuancheng\\remotesensing\\tif"
rootdir = 'E:\\xuancheng\\remotesensing\\tif'
for dirpath,filename,filenames in os.walk(rootdir):
    for filename in filenames:
        if os.path.splitext(filename)[1] == '.tif':
            filepath = os.path.join(dirpath,filename)
            inRaster = filepath
            outname = filename.replace('.tif','')
            print "ok"
            print filepath
            print outname
            outASCII = "E:\\1206\\"+outname+".asc"
            arcpy.RasterToASCII_conversion(filepath, outASCII)
            print outname

转载自:https://blog.csdn.net/hnyzwtf/article/details/44852679

You may also like...