Landmark Source

Zusammenfassung

The Landmark Source object provides information about the configuration of landmarks used in generating driving directions.

Eigenschaften

EigenschaftErläuterungDatentyp
featureClassName
(Schreibgeschützt)

The name of the point feature class associated with this landmark source.

String
labelFieldName
(Schreibgeschützt)

The name of the text field in the landmark feature class that describes the landmark.

String
levelFieldName
(Schreibgeschützt)

The name of the field used to associate landmarks with a specific floor level of a building.

String
searchTolerance
(Schreibgeschützt)

The size of the search radius. In general, when a route passes by a landmark within the search radius, it is reported in the directions. The units for this field are specified under searchToleranceUnits.

Double
searchToleranceUnits
(Schreibgeschützt)

The units of the searchTolerance value.

String
useSpatialSearch
(Schreibgeschützt)

A Boolean indicating whether the landmarks are spatial (True) or nonspatial (False).

Boolean

Codebeispiel

Landmark Source example
# 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.")