WOTable (arcpy.sa)
Summary
Defines the input rasters, the field identifying the input values, the remap of their values, the weight of each raster, and the evaluation scale to use in the Weighted Overlay tool.
Discussion
The Weighted Overlay tool uses the WOTable object.
For each value in an input raster identified in the WOTable object, the Weighted Overlay tool assigns a new value based on a remap object. The two remap classes that are available are RemapValue and RemapRange. However, since WOTable generally works with categorical data, the RemapValue object is the recommended input.
In the Weighted Overlay tool each input raster in the WOTable object is weighted according to its importance or its percent influence, which is also defined in the object. The weight is a relative percentage, and the sum of the percent influence weights must equal 100 percent.
The from, to, and by evaluation scale parameters have no effect on the resulting calculations but are necessary input.
Syntax
Parameter | Explanation | Data Type |
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 |
Properties
Property | Explanation | Data Type |
weightedOverlayTable (Read and Write) |
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 (Read and Write) |
The range and interval for the new values by which to remap the old values. | List |
Code Sample
Demonstrates how to create a WOTable class and use it in the WeightedOverlay tool within the Python window.
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")
Performs a weighted overlay analysis using the WOTable class.
# 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")