HfForward (arcpy.sa)
摘要
通过向前函数定义水平成本系数和水平相对移动角度之间的关系。此函数只允许建立向前移动。
插图
讨论
HfForward 对象用于 Spatial Analyst 工具路径距离、路径距离分配和路径距离回溯链接。
如果某段行程的水平相对移动角度 (HRMA) 小于 45 度,则将水平系数 (HF) 设置为与零系数相关联的值。当 HRMA 大于或等于 45 度且小于 90 度时,将 HF 设置为边值。如果 HRMA 大于或等于 90 度,则将 HF 设置为无穷大。
语法
参数 | 说明 | 数据类型 |
zeroFactor |
The zeroFactor will be used to position the y-intercept of the forward function. (默认值为 0.5) | Double |
sideValue |
Identifies the HF value that will be assigned for HRMAs that are equal to or less than 45 degrees and less than 90 degrees. In the diagram above, the sideValue is assigned 1. (默认值为 1.0) | Double |
属性
属性 | 说明 | 数据类型 |
zeroFactor (读写) |
The zeroFactor will be used to position the y-intercept of the function. The zeroFactor is assigned as the horizontal factor when HRMA is less then the cut angle. | Double |
sideValue (读写) |
Identifies the HF value that will be assigned for HRMAs that are equal to or less than 45 degrees and less than 90 degrees. In the diagram above the sideValue is assigned 1. | Double |
代码实例
演示如何创建 HfForward 类以及如何在 Python 窗口的 PathDistance 工具中使用该类。
import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
myHorizFactor = HfForward(0.5, 1.0)
outPathDist = PathDistance("sourcepts.shp", "costraster", "", "", myHorizFactor)
outPathDist.save("C:/sapyexamples/output/pathdisthff")
使用 HfForward 类执行 PathDistance 分析。
# Name: HfForward_Ex_02.py
# Description: Uses the HfForward object to execute the PathDistance 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
inSourceData = "sourcepts.shp"
inCostRaster = "costraster"
# Create the HfForward Object
zeroFactor = 0.5
sideValue = 1.0
myHorizFactor = HfForward(zeroFactor, sideValue)
# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")
# Execute PathDistance
outPathDist = PathDistance(inSourceData, inCostRaster, "", "", myHorizFactor)
# Save the output
outPathDist.save("C:/sapyexamples/output/pathdisthff2")