RemapRange

此 ArcGIS 2.8 文档已 存档,并且不再对其进行更新。 其中的内容和链接可能已过期。 请参阅最新文档

需要 Spatial Analyst 许可。

摘要

将输入值重分类为输出栅格所对应的区间列表。

插图

RemapRange 重映射表图像示例
重分类功能的 RemapRange 重映射表示例。

说明

RemapRange 对象可用于重分类工具和 WOTable 类中。

要进行重映射的输入值可以为整型或浮点型。

通过在 startValueendValue 区间内输入 NoData(字符串)作为 newValue,可以将旧值指定为 NoData。

如果输入值是连续的(如高程值或距离值),或如上述土地利用示例中描述的那样需要更改分类数据的分组,则通常会用到按值的范围进行重分类。

要将单个值重分类为新值,需要将 startValueendValue 设置为相同的值(重分类的目标值)。

除非位于两个输入范围的边界处,否则值的输入范围不应发生重叠。发生重叠时,较低输入范围的最大值将包含在取值范围中,而较高输入范围的最小值将不包含在取值范围中。例如:

1 3 : 5   (where  1 <= value <= 3, values remapped to 5)
3 5 : 3   (where  3 <  value <= 5, values remapped to 3)
5 7 : 1   (where  5 <  value <= 7, values remapped to 1)

语法

 RemapRange (remapTable)
参数说明数据类型
remapTable
[[startValue, endValue, newValue],...]

用于将旧值(按范围指定)重映射为新值的重映射表。

其定义要重分类为新值的输入值(按范围指定)列表。这是一个列表的列表,且内部列表是由三个部分组成。

这三个部分为:

  • startValue - 要指定给新输出值的值范围的下限。(数据类型:双精度型)
  • endValue - 要指定给新输出值的值范围的上限。(数据类型:双精度型)
  • newValue - 要指定给由起始值和结束值所定义的输入值范围的新值。(数据类型:整型)

List

属性

属性说明数据类型
remapTable
(可读写)

用于将原始值重映射到新值的重映射表。

List

代码示例

RemapRange 示例 1(Python 窗口)

演示如何创建 RemapRange 类以及如何在 Python 窗口的 Reclassify 工具中使用该类。

import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
myRemapRange = RemapRange([[-3, 0, 0], [0, 1.75, 25], [1.75, 3.5, 50],
                            [3.5, 5.25, 75], [5.25, 7, 100]])
outReclassRR = Reclassify("inreclass", "VALUE", myRemapRange)
outReclassRR.save("C:/sapyexamples/output/rclassremran")
RemapRange 示例 2(独立脚本)

使用 RemapRange 类执行重分类。

# Name: RemapRange_Ex_02.py
# Description: Uses the RemapRange object to execute Reclassify 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
inRaster = "inreclass"

# Define the RemapValue Object 
myRemapRange = RemapRange([[-3, -1.75, 1], [-1.75, -0.5, 2], [-0.5, 0.75, 3],
                            [0.75, 2, 4], [2, 3.25, 5], [3.25, 4.5, 6],
                            [4.5, 5.75, 7], [5.75, 7, 8]])

# Execute Reclassify
outReclassRR = Reclassify(inRaster, "VALUE", myRemapRange)

# Save the output 
outReclassRR.save("C:/sapyexamples/output/reclassreran2")

相关主题