Network Source Directions (arcpy)
摘要
网络源方向对象将提供用于生成行驶方向(特定于网络数据集中的边源)的信息。
属性
属性 | 说明 | 数据类型 |
adminAreaFieldName (只读) |
The name of the field containing the administrative area information for generating driving directions. If the administrative area information is not defined for the network dataset, adminAreaFieldName property will throw an exception. | String |
streetNameFields (只读) |
Returns a Python list of Street Name Field objects for this network source. | List |
shields (只读) |
Returns the Shields object. This object can be used to determine the shield properties used in driving directions. If the shields information is not defined for the network dataset, shields property will throw an exception. | Object |
代码实例
网络源方向属性示例
显示网络数据集中特定于边源的方向信息。
# Name: NDSNetworkSourceDirectionProperties_ex01.py
# Description: Print direction settings specific to edge sources in the network
# dataset.
import arcpy
import sys
# Set the workspace
arcpy.env.workspace = "C:/Data/SanFrancisco.gdb/Transportation"
# Create Describe object for the network dataset
desc = arcpy.Describe("Streets_ND")
#If the directions are not set for the network dataset, exit
if not desc.supportsDirections:
print "No direction information"
sys.exit()
print "Source Direction Information ----"
# Get all the edge sources
sources = desc.edgeSources
#If there are no edge sources in the network dataset, quit.
if not sources:
print "No edge sources"
sys.exit()
#Loop through all the edge sources
for source in sources:
print "--------------------"
print "Name: " , source.name
print "Source ID: " , source.sourceID
#Print the direction information specific to edge source
sDir = source.sourceDirections
# Check if the administrative area information is defined for the network
#dataset. Otherwise adminAreaFieldName property throws an exception
if hasattr(sDir, "adminAreaFieldName"):
print "Administrative area field: " , sDir.AdminAreaFieldName
else:
print "Administrative area field: " , "Not set"
5/10/2014