Bootstrap

arcGIS python求取栅格数据的平均值。

arcGIS python求取栅格数据的平均值。

下载链接:栅格要素求平均值arcpy实例demo

#-*- coding:UTF-8 -*-
import arcpy
from arcpy import env
from arcpy.sa import *

env.workspace = r"C:\Users\HP\Desktop\20210323\tweets.gdb"

#CheckOut liscen SpatialAnalysis
arcpy.CheckOutExtension("ImageAnalyst")
arcpy.CheckOutExtension("Spatial")
env.overwriteOutput = 1

#(1)求去栅格数据平均值
outDACA = r"C:\Users\HP\Desktop\20210323\tweets.gdb\temp_DACA_KDE"
#read Raster
DACA_Raster = arcpy.Raster(outDACA)

#栅格计算器,求平均值
meanValueInfo = arcpy.GetRasterProperties_management(DACA_Raster, 'MEAN')
meanValue = float(meanValueInfo.getOutput(0))
print("average Value is:" + str(meanValue))
;