需要 Spatial Analyst 许可。
所有地图代数语句都要求其输入使用工具和运算符(只有可选参数的 CreateNormalRaster 和 CreateRandomRaster 除外)。
输入规则
- 要直接使用输入数据(磁盘、图层、表、字段名称中的数据),必须将其放在加引号的字符串中。
# The full path and nmae of the dataset is used outRas = Slope("C:/Data/elevation") # If the layer is in the Table of contents or in your workspace then just the quoted name is needed outRas2 = Slope("elevation")
# In the following statement Population is a field name outRas2 = KernelDensity("inpoints", "Population")
- 可以将现有输入数据分配给变量,并且可在语句中使用该变量。变量不加引号。
inputElevation = "C:/Data/dem" outRas = slope(inputElevation)
- 可将栅格对象用作后续语句的输入。栅格对象是变量,因此不需要加引号。
outSource = ExtractByAttributes("inraster", "Value > 3000") # The output of ExtractByAttributes is used as input to EucDistance outDistance = EucDistance(outSource)
- 同样可将结果对象用作地图代数表达式的输入。
# Buffer returns a Result object, which is used here as # input to EucDistance dist = EucDistance(arcpy.Select_analysis("schools", "#", "Pop>2000"))
- 很多工具接受一个参数有多个输入(多值输入)。输入之间以逗号分隔并用方括号括起(表示 Python 列表)。
outStats = CellStatistics(["inraster1", "inraster2", "inraster3"], "MEAN")