摘要
地标源对象提供了与用于生成行驶方向的地标配置相关的信息。
属性
属性 | 说明 | 数据类型 |
featureClassName (只读) | 与该地标源相关联的点要素类的名称。 | String |
labelFieldName (只读) | 地标要素类中的文本字段的名称,用于描述地标。 | String |
levelFieldName (只读) | 用于将地标与建筑物的特定楼层相关联的字段的名称。 | String |
searchTolerance (只读) | 搜索半径的大小。通常,当路径通过搜索半径范围内的路标时,将在方向中报告该路标。该字段的单位在 searchToleranceUnits 下指定。 | Double |
searchToleranceUnits (只读) | searchTolerance 值单位。 | String |
useSpatialSearch (只读) | 指示地标为空间地标 (True) 还是非空间地标 (False) 的布尔值。 | Boolean |
代码示例
# Name: NDSLandmarks_ex01.py
# Description: Print information about the directions landmarks associated
# with edge sources in the network dataset.
import arcpy
import sys
def printLandmarkInfo(landmarks):
for lm in landmarks:
print("\nLandmarks feature class name:", lm.featureClassName)
print("Label field name:", lm.labelFieldName)
print("Level field name:", lm.levelFieldName)
print("Search tolerance:", lm.searchTolerance)
print("Search tolerance units:", lm.searchToleranceUnits)
print("Landmarks are spatial:", lm.useSpatialSearch)
network = r"C:/Data/NetworkDatasetWithLandmarks.gdb/Transportation/Streets_ND"
# Create Describe object for the network dataset
desc = arcpy.Describe(network)
#If the directions are not set for the network dataset, exit
if not desc.supportsDirections:
print("No direction information")
sys.exit()
# 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("\n--------------------")
print("Edge source name: " , source.name)
# Get the directions information specific to this edge source
sDir = source.sourceDirections
# Check if the edge source has turn and confirmation landmarks associated with it.
# If so, print some information about the landmarks.
if hasattr(sDir, "landmarkEventSources"):
landmarkEventSources = sDir.landmarkEventSources
print("\n--Confirmation landmark information--")
printLandmarkInfo(landmarkEventSources)
else:
print("Source does not have confirmation landmarks.")
if hasattr(sDir, "landmarkManeuverSources"):
landmarkManeuverSources = sDir.landmarkManeuverSources
print("\n--Turn landmark information--")
printLandmarkInfo(landmarkManeuverSources)
else:
print("Source does not have turn landmarks.")