# HfTable

Disponible avec une licence Spatial Analyst.

## Synthèse

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

This object is used in the Distance Accumulation and Distance Allocation Spatial Analyst tools, as well as the Path Distance, Path Distance Allocation, and Path Distance Back Link Legacy Distance tools.

## Syntaxe

`HfTable (inTable)`
 Paramètre Explication Type de données 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

## Propriétés

 Propriété Explication Type de données inTable(Lecture et écriture) 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

## Exemple de code

HfTable example 1 (Python window)

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

``````import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
myHorizFactor = HfTable("hffile.txt")
outDistAccum = DistanceAccumulation("source.shp", "barrier.tif",
"elev.tif", "", "", "",
"horizontalRas.tif", myHorizFactor)
outDistAccum.save("C:/sapyexamples/output/distaccumhft")``````
HfTable example 2 (stand-alone script)

Performs a DistanceAccumulation analysis using the HfTable class.

``````# Name: HfTable_Ex_02.py
# Description: Uses the HfTable object to run the
#              DistanceAccumulation 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"
inSurfaceRaster = "elevation.tif"
inHorizontalRaster = "horizontalRas.tif"

# Create the HfTable Object
inTable = "hffile.txt"
myHorizFactor = HfTable(inTable)

# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")

# Execute PathDistance
outDistAccum = DistanceAccumulation(inSourceData,"", inSurfaceRaster,"","",
"", inHorizontalRaster, myHorizFactor)

# Save the output
outDistAccum.save("C:/sapyexamples/output/distaccumhft2")``````