加权总和 (空间分析)

许可等级:BasicStandardAdvanced

摘要

通过将栅格各自乘以指定的权重并合计在一起来叠加多个栅格。

了解有关“加权总和”工作原理的详细信息

插图

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 top 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.

用法

语法

WeightedSum (in_rasters)
参数说明数据类型
in_rasters
in_weighted_sum_table

加权总和工具通过将栅格数据各自乘以指定的权重并合计在一起来叠加多个栅格数据。

叠加分析类用于定义表。WSTable 对象用于指定输入栅格的 Python 列表并对输入栅格进行相应的加权。

WSTable 对象的形式为:

  • WSTable (weightedSumTable)

WSTable

返回值

名称说明数据类型
out_raster

输出适宜性栅格。

此栅格为浮点类型。

Raster

代码实例

WeightedSum 示例 1(Python 窗口)

本示例通过将多个栅格数据合并到一起并应用适当的加权因子来创建适宜性栅格,用以为滑雪场地选址。

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 示例 2(独立脚本)

本示例通过将多个栅格数据合并到一起并应用适当的加权因子来创建适宜性栅格,用以为滑雪场地选址。

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

环境

相关主题

许可信息

ArcGIS for Desktop Basic: 需要 Spatial Analyst
ArcGIS for Desktop Standard: 需要 Spatial Analyst
ArcGIS for Desktop Advanced: 需要 Spatial Analyst
5/10/2014