1. 程式人生 > >【基礎功能】ArcPy批量柵格轉向量

【基礎功能】ArcPy批量柵格轉向量

批量處理100個柵格轉向量,用ACRGIS得弄到手殘,所以~不如跳舞~~~哈哈~~~當讓是不如碼程式碼

這是用python語言,Arcpy的強大助力批量讓100個名稱帶有數字,從3-300,間隔為3的tif轉為shp向量檔案

import arcpy
from arcpy import env

env.workspace = "E:/data/temp/data"
field = "VALUE"
inRaster = "single_"
outPolygons = "E:/data/temp/data/shpsingle_"
num = 3
while(num <= 300):
    inRaster += str(num)
    inRaster += ".tif"
    outPolygons += str(num)
    outPolygons += ".shp"
    arcpy.RasterToPolygon_conversion(inRaster, outPolygons, "NO_SIMPLIFY", field)
    inRaster = "single_"
    outPolygons = "E:/data/temp/data/shpsingle_"
    num += 3
print "finish"