ArcGIS Tutorial: Weighted sum

Source: Internet
Author: User

  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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.