Skip To Content

HfTable

Available with Spatial Analyst license.

Summary

Defines the relationship between the horizontal cost factor and the horizontal relative moving angle through a specified table file. The table file identifies the horizontal factor graph used to determine the horizontal factors.

Discussion

The HfTable object is used in the Spatial Analyst tools Path Distance, Path Distance Allocation, and Path Distance Back Link.

Syntax

 HfTable (inTable)
ParameterExplanationData Type
inTable

The inTable is an ASCII file with two columns on each line. The first column identifies the HRMA in degrees, and the second, the HF. Each line specifies a point. Two consecutive points produce a line segment in the HRMA-HF coordinate system. The angles must be input in ascending order. The HF factor for any HRMA angle less than the first (lowest) input value or larger than the last (largest) input value will be set to infinity. An infinite HF is represented by -1 in the ASCII file.

File

Properties

PropertyExplanationData Type
inTable
(Read and Write)

The inTable is of an ASCII file with two columns on each line. The first column identifies the HRMA in degrees, and the second, the HF. Each line specifies a point. Two consecutive points produce a line segment in the HRMA-HF coordinate system. The angles must be input in ascending order. The HF factor for any HRMA angle less than the first (lowest) input value or larger than the last (largest) input value will be set to infinity. An infinite HF is represented by -1 in the ASCII file.

String

Code sample

HfTable example 1 (Python window)

Demonstrates how to create an HFTable class and use it in the PathDistance tool within the Python window.

import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
myHorizFactor = HfTable("hffile.txt")
outPathDist = PathDistance("source.shp", "costraster", "", "", myHorizFactor)
outPathDist.save("C:/sapyexamples/output/pathdisthft")
HfTable example 2 (stand-alone script)

Performs a PathDistance analysis using the HFTable class.

# Name: HfTable_Ex_02.py
# Description: Uses the HfInverseLinear object to execute the HfTable 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 HfTable Object
inTable = "hffile.txt"
myHorizFactor = HfTable(inTable)

# Execute PathDistance
outPathDist = PathDistance(inSourceData, inCostRaster, "", "", myHorizFactor)

# Save the output 
outPathDist.save("C:/sapyexamples/output/pathdisthft2")

Related topics