WOTable (arcpy.sa)
摘要
定义输入栅格、标识输入值的字段、栅格值的重映射、每个栅格的权重以及评估等级供加权叠加工具使用。
讨论
加权叠加工具使用 WOTable 对象。
对于在 WOTable 对象中标识的输入栅格中的每个值,加权叠加工具可根据重映射对象指定新值。两个可用的重映射类为 RemapValue 和 RemapRange。然而,由于 WOTable 通常用于处理分类数据,因此,建议输入 RemapValue 对象。
在加权叠加工具中,WOTable 对象中的每个输入栅格都是根据其重要性或者影响力百分比(此对象也进行了定义)进行加权。权重是相对百分比,并且影响力百分比权重的总和必须等于 100%。
“起始”、“终止”和“增量”评估级别参数不会影响所得计算值,但是却必须输入。
语法
参数 | 说明 | 数据类型 |
weightedOverlayTable [[inRaster, influence, field, Remap],...] |
The table specifying the input rasters, their influence, the field to use, and the remap table identifying what the old values should be remapped to.
In addition to numerical values for the scaled weights in the remap table, the following options are available:
| List |
evaluationScale [from, to, by] |
The range and interval for the new values in which to remap the old values. The parameter is required for both the dialog box and scripting but it has no effect in scripting.
| List |
属性
属性 | 说明 | 数据类型 |
weightedOverlayTable (读写) |
Contains the weighted overlay table identifying the rasters to be remapped, the amount of influence of each raster, the values to be remapped, and the values to remap them to. | List |
evaluationScale (读写) |
The range and interval for the new values by which to remap the old values. | List |
代码实例
演示如何创建 WOTable 类以及如何在 Python 窗口的 WeightedOverlay 工具中使用该类。
import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
myWOTable = WOTable([["snow", 50, "VALUE", RemapValue([[0, 1], [1, 1], [5, 5],
[6, 6], [7, 7], [8, 8], [9, 9], ["NODATA", "NODATA"]])],
["land", 20, "VALUE", RemapValue([[0, 1], [1, 1], [5, 5],
[6, 6],[7, 7], [8, 8], [9, 9], ["NODATA", "NODATA"]])],
["soil", 30, "VALUE", RemapValue([[0, 1], [1, 1], [2, 2],
[3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9],
["NODATA", "NODATA"]])]], [1, 9, 1])
outWeightedOverlay = WeightedOverlay(myWOTable)
outWeightedOverlay.save("C:/sapyexamples/output/woverlaytbl")
使用 WOTable 类执行加权叠加分析。
# Name: WOTable_Ex_02.py
# Description: Uses the WOTable object to execute WeightedOverlay tool.
# Requirements: Spatial Analyst Extension
# Import system modules
import arcpy
from arcpy import env
from arcpy.sa import *
# Set environment settings
env.workspace = "C:/sapyexamples/data"
# Set local variables
inRaster1 = "snow"
inRaster2 = "land"
inRaster3 = "soil"
# Define WOTable
myWOTable = WOTable([[inRaster1, 50, "VALUE", RemapValue([[1, 1], [5, 5],
[6, 5], [7, 5], [8, 9], [9, 9], ["NODATA", "NODATA"]])],
[inRaster2, 20, "VALUE", RemapValue([[1, 1], [5, 5],
[6, 5], [7, 5], [8, 9], [9, 9], ["NODATA", "NODATA"]])],
[inRaster3, 30, "VALUE", RemapValue([[1, 1], [2, 1],
[3, 1], [4, 5], [5, 5], [6, 5], [7, 9], [8, 9], [9, 9],
["NODATA", "NODATA"]])]], [1, 9, 1])
# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")
# Execute WeightedOverlay
outWeightedOverlay = WeightedOverlay(myWOTable)
# Save the output
outWeightedOverlay.save("C:/sapyexamples/output/woverlaytbl2")