Summary
Overlay multiple rasters by multiplying the rasters by their assigned weights and summing them together.
Illustrations
In the illustration, the cell value is multiplied by its weighting factor, and the resulting results are added together to create the output raster. Take the upper left cell as an example. The two input values change to (2.2 * 0.75) = 1.65 and (3 * 0.25) = 0.75. 1.5 with 0.75 and for 2.4.
Usage
· The effective way to add multiple raster data together is to enter multiple rasters and set all weights to 1.
· The input raster can be an integer or float type.
· The weight value can be a positive or negative decimal number. The value must not be qualified as a relative percentage or equal to 1.0.
· The weights are applied to the specified field of the input raster. The type of the field can be either a short integer or a long integer, double or floating point type.
Grammar
Weightedsum (In_rasters)
Code instance
weightedsum Example 1 (Python window)
This example creates a suitability raster by merging multiple raster data together and applying the appropriate weighting factor to site the ski site.
Import arcpy
From arcpy Import env
From ARCPY.SA Import *
Env.workspace = "C:/sapyexamples/data"
# Execute Weightedsum
Outweightedsum = Weightedsum (Wstable ([["Snow", "value", 0.25], ["Land", "value", 0.25],
["Soil", "VALUE", 0.5]]))
Outweightedsum.save ("C:/sapyexamples/output/outwsum")
Weightedsum Example 2 (stand-alone script)
This example creates a suitability raster by merging multiple raster data together and applying the appropriate weighting factor to site the ski site.
# Name:WeightedSum_Ex_02.py
# description:overlays Several rasters multiplying each by their given
# weight and summing them together.
# 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"
Wsumtableobj = Wstable ([[[InRaster1, "value", 0.25], [InRaster2, "value", 0.25],
[InRaster3, "VALUE", 0.5]])
# Check out the ArcGIS Spatial Analyst extension License
arcpy. Checkoutextension ("Spatial")
# Execute Weightedsum
Outweightedsum = Weightedsum (wsumtableobj)
# Save the output
Outweightedsum.save ("C:/sapyexamples/output/weightsumout")
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
ArcGIS Tutorial: Weighted sum