Skip To Content

Landmark Source

Summary

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

Properties

PropertyExplanationData Type
featureClassName
(Read Only)

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

String
labelFieldName
(Read Only)

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

String
levelFieldName
(Read Only)

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

String
searchTolerance
(Read Only)

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
(Read Only)

The units of the searchTolerance value.

String
useSpatialSearch
(Read Only)

A Boolean indicating whether the landmarks are spatial (True) or nonspatial (False). Nonspatial landmarks are associated with the ObjectID of a particular edge feature, whereas the position of spatial landmarks is determined by geometry.

Boolean

Code sample

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.")