Network Directions Attribute Mapping

Synthèse

The Network Directions Attribute Mapping object provides information about the descriptor attributes in your network dataset that are mapped to specific properties in the network dataset's directions configuration.

Propriétés

PropriétéExplicationType de données
attribute
(Lecture seule)

The name of the network attribute mapped to the directions property described by the key property.

String
key
(Lecture seule)

The name of the network dataset directions property to which the network dataset's attribute is being mapped.

String

Exemple de code

Network Directions Attribute Mapping Properties example

Print the network dataset's directions attribute mapping properties.

# Name: NDSDirectionsAttributeMapping_ex01.py
# Description: Print information about the directions attribute mappings
#              for the network dataset.

import arcpy
import sys

network = r"C:/Data/NetworkDatasetWithDirections.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 network's directions properties
directions = desc.directions

# Loop through the attribute mappings
if hasattr(directions, "attributeMappings"):
    attrMappings = directions.attributeMappings
    for mapping in attrMappings:
        print("\nKey:", mapping.key)
        print("Attribute:", mapping.attribute)
else:
    print("Network dataset does not contain directions attribute mappings.")