最近在arcgis克里格插值後需要得到插值後的矩陣。找了很久才找到工具箱中的calculateZvalue,但是一次只能計算一個點,因此需要用腳本去提取。
import arcpy
arcpy.CheckOutExtension("GeoStats")
total=0
points=[]
for width in range(37578564,37636464,50):
for row in range(3279256,3354160,50):
point="%d"%width+" "+"%d"%row#整數轉化爲字符串
outCZV = arcpy.GACalculateZValue_ga("G:\科研立項\kriginghigher.lyr", point)
addprint=point+" "+str(outCZV)+"\n"
points.append(addprint)
myfile = open("C:\\Users\\Administrator\\Desktop\\resultofkrige.txt", "a")
myfile.writelines( points)
myfile.close()
total+=1
print "第"+str(total)
points=[]