Populate Alternate ID Fields (Network Analyst)

Summary

Creates and populates additional fields on the turn feature classes that reference the edges in the network by alternate IDs. The alternate IDs help maintain the integrity of the turn features if the edge sources are edited in such a way that their ObjectID values change.

Learn more about turns in a network dataset

Usage

  • The Edge#FID fields in a turn feature class refer to the ObjectID of the line feature in an edge source in the network. However, ObjectIDs are system managed and can change during certain editing operations. To ensure that the turn features retain the correct reference to the edge features after this type of editing workflow, use the following workflow:

    1. Create and populate a unique ID field in each of the network's edge source feature class. Alternatively, use a unique ID field included in the data by the data provider, if one exists.
    2. Run the Populate Alternate ID Fields tool to create and populate a set of alternate ID fields (AltID#) in the network dataset's turn feature classes. The tool populates the alternate ID fields with the designated unique ID field values from the edge sources, linking each turn feature to the appropriate edge source feature through the alternate ID fields in addition to the Edge#FID fields.
    3. Perform the edit operations that may change the ObjectIDs of the edge sources.
    4. Run the Update By Alternate ID Fields tool to update the Edge#FID fields in the turn feature classes using the alternate ID field values to look up the ObjectID values of the corresponding edge source features.

  • The tool creates and populates new AltID# fields in which # is the maximum number of edges per turn. For example, for turn feature classes that support turns of up to three edges, the tool creates and populates the AltID1, AltID2, and AltID3 fields.

Parameters

LabelExplanationData Type
Input Network Dataset

The network dataset whose turn feature classes will receive alternate ID fields. The fields will be created on all of the turn feature classes added as a turn source to the network dataset.

Network Dataset Layer
Alternate ID Field Name

The name of the alternate ID field on the edge feature sources of the network dataset. All edge feature sources referenced by turns must have the same name for the alternate ID field.

String

Derived Output

LabelExplanationData Type
Updated Input Network Dataset

The updated network dataset.

Network Dataset Layer

arcpy.management.PopulateAlternateIDFields(in_network_dataset, alternate_ID_field_name)
NameExplanationData Type
in_network_dataset

The network dataset whose turn feature classes will receive alternate ID fields. The fields will be created on all of the turn feature classes added as a turn source to the network dataset.

Network Dataset Layer
alternate_ID_field_name

The name of the alternate ID field on the edge feature sources of the network dataset. All edge feature sources referenced by turns must have the same name for the alternate ID field.

String

Derived Output

NameExplanationData Type
out_network_dataset

The updated network dataset.

Network Dataset Layer

Code sample

PopulateAlternateIDFields example 1 (Python window)

Run the tool using all parameters.

network = "C:/Data/SanFrancisco.gdb/Transportation/Streets_ND"
arcpy.na.PopulateAlternateIDFields(network, "ID")
PopulateAlternateIDFields example 2 (stand-alone script)

The following Python script demonstrates how to use the PopulateAlternateIDFields function in a stand-alone script.

# Name: PopulateAlternateIDFields_ex02.py
# Description: Create and populate the alternate ID fields for all turn sources
#              in the network dataset.
# Requirements: Network Analyst Extension

#Import system modules
import arcpy
from arcpy import env

#Set environment settings
env.workspace = "C:/data/SanFrancisco.gdb/Transportation"

#Set local variables
inNetworkDataset = "Streets_ND"
altIDFieldName = "ID"

#Populate alternate IDs on all turn sources in the network dataset
arcpy.PopulateAlternateIDFields_na(inNetworkDataset,altIDFieldName)

print("Script completed successfully.")

Environments