HfLinear (arcpy.sa)

摘要

通过线性函数定义水平成本系数和水平相对移动角度之间的关系。该函数规定水平系数与水平相对移动角度具有线性关系。

插图

HfLinear 水平系数图像
路径距离功能的 HfLinear 水平系数。

讨论

HfLinear 对象用于 Spatial Analyst 工具路径距离路径距离分配路径距离回溯链接

水平系数 (HF) 由水平相对移动角度 (HRMA)-HF 坐标系中的一条直线确定。这条线在 y 轴(表示 HF 系数)上与零系数相关联的值处进行截取。线的斜率可以通过斜率修饰属性进行指定。如果未确定斜率,则默认值为 0.5/45 或 1/90(指定为 0.01111)。

语法

HfLinear ({zeroFactor}, {cutAngle}, {slope})
参数说明数据类型
zeroFactor

The zeroFactor will be used to position the y-intercept of the linear function.

(默认值为 0.5)

Double
cutAngle

The cutAngle establishes the HRMA degree threshold beyond which the HFs are set to infinity.

(默认值为 181.0)

Double
slope

Identifies the slope of the straight line in the HRMA-HF coordinate system. Slope is specified as the rise over the run. For example, a 30-degree slope is 1/30, specified as 0.03333 (rise/run: 1 HF on the y axis / 30 degrees on the x axis).

(默认值为 0.011111)

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
cutAngle
(读写)

The cutAngle establishes the HRMA degree threshold beyond which the HFs are set to infinity.

When the HRMA is less than the cut angle then the zero factor is assigned and when the HRMA is greater than the cut angle, infinity is assigned.

Double
slope
(读写)

Identifies the slope of the straight line in the HRMA-HF coordinate system. Slope is specified as the rise over the run. For example, a 30-degree slope is 1/30, specified as 0.03333 (rise/run: 1 HF on the y axis / 30 degrees on the x axis).

Double

代码实例

HfLinear 示例 1(Python 窗口)

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

import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
myHorizFactor = HfLinear(0.5, 181.0, 0.01111)
outPathDist = PathDistance("source.shp", "costraster", "", "", myHorizFactor)
outPathDist.save("C:/sapyexamples/output/pathdisthfl")
HfLinear 示例 2(独立脚本)

使用 HfLinear 类执行 PathDistance 分析。

# Name: HfLinear_Ex_02.py
# Description: Uses the HfLinear 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 = "source.shp"
inCostRaster = "costraster"

# Create the HfLinear Object
zeroFactor = 0.5
cutAngle = 181.0
slope = 0.01111
myHorizFactor = HfLinear(zeroFactor, cutAngle, slope)

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

相关主题

9/15/2013