ArcGIS for Desktop

  • Documentation
  • Pricing
  • Support

  • My Profile
  • Help
  • Sign Out
ArcGIS for Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS for Desktop

A complete professional GIS

ArcGIS for Server

GIS in your enterprise

ArcGIS for Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Pricing
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

Help

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • More...

Weighted Sum

Available with Spatial Analyst license.

  • Summary
  • Illustration
  • Usage
  • Syntax
  • Code Sample
  • Environments
  • Licensing Information

Summary

Overlays several rasters, multiplying each by their given weight and summing them together.

Learn more about how Weighted Sum works

Illustration

Weighted Sum illustration
In the illustration, the cell values are multiplied by their weight factor, and the results are added together to create the output raster. For example, consider the upper left cell. The values for the two inputs become (2.2 * 0.75) = 1.65 and (3 * 0.25) = 0.75. The sum of 1.5 and 0.75 is 2.4.

Usage

  • A useful way to add several rasters together is to input multiple rasters and set all weights equal to 1.

  • Input rasters can be integer or floating point.

  • The weight values can be any positive or negative decimal value. It is not restricted to a relative percentage nor does it need to be equal to 1.0.

  • The weight will be applied to the specified field for the input raster. Fields can be of type short or long integer, double or float.

  • By default, this tool will take advantage of multi-core processors. The maximum number of cores that can be utilized is limited to 4.

    If you wish the tool to use fewer cores, use the parallelProcessingFactor environment setting.

  • See Analysis environments and Spatial Analyst for additional details on the geoprocessing environments that apply to this tool.

Syntax

WeightedSum (in_rasters)
ParameterExplanationData Type
in_rasters
in_weighted_sum_table

TheWeighted Sum tool overlays several rasters, multiplying each by their given weight and summing them together.

An Overlay class is used to define the table. The WSTable object is used to specify a Python list of input rasters and weight them accordingly.

The form of the object is:

  • WSTable (weightedSumTable)

WSTable

Return Value

NameExplanationData Type
out_raster

The output suitability raster.

It will be of floating-point type.

Raster

Code Sample

WeightedSum example 1 (Python window)

This example creates a suitability raster for locating a ski resort by combining multiple rasters together and applying appropriate weight factors.

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 for locating a ski resort by combining multiple rasters together and applying appropriate weight factors.

# 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")

Environments

  • Auto Commit
  • Cell Size
  • Current Workspace
  • Extent
  • Geographic Transformations
  • Mask
  • Output CONFIG Keyword
  • Output Coordinate System
  • Parallel Processing Factor
  • Scratch Workspace
  • Snap Raster
  • Tile Size

Licensing Information

  • ArcGIS for Desktop Basic: Requires Spatial Analyst
  • ArcGIS for Desktop Standard: Requires Spatial Analyst
  • ArcGIS for Desktop Advanced: Requires Spatial Analyst

Related Topics

  • An overview of the Overlay tools
  • Understanding overlay analysis
  • Overlay analysis approaches
  • Weighted Overlay
Feedback on this topic?

ArcGIS for Desktop

  • Home
  • Documentation
  • Pricing
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS for Desktop
  • ArcGIS for Server
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Insiders Blog
  • User Conference
  • Developer Summit
Esri
© Copyright 2016 Environmental Systems Research Institute, Inc. | Privacy | Legal