Update by Alternate ID Fields (Network Analyst)

Summary

Updates all the edge references in turn feature classes using an alternate ID field to identify the corresponding edge features for each turn. Use this tool after making edits to the edge source feature classes that alter ObjectID values.

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.

Parameters

LabelExplanationData Type
Input Network Dataset

The network dataset whose turn feature classes will be updated by their alternate ID fields.

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.na.UpdateByAlternateIDFields(in_network_dataset, alternate_ID_field_name)
NameExplanationData Type
in_network_dataset

The network dataset whose turn feature classes will be updated by their alternate ID fields.

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

UpdateByAlternateIDFields example 1 (Python window)

Run the tool using all parameters.

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

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

# Name: UpdateByAlternateIDFields_ex02.py
# Description: Update the edge references in the turn feature classes using
#              alternate IDs and build 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"

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

#Update the edge references in the turn features using alternate ID fields
arcpy.UpdateByAlternateIDFields_na(inNetworkDataset, altIDFieldName)

#Since we have modified the edge references for turn sources, we should rebuild
#the network dataset so that the turn features are correctly interpreted by the
#network dataset
arcpy.BuildNetwork_na(inNetworkDataset)

print("Script completed successfully.")

Environments

Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes

Related topics