Create Turn Feature Class (Network Analyst)

Summary

Creates a new turn feature class to store turn features that model turning movements in a network dataset.

Usage

  • You can add a turn feature class as a turn sources to your network only if your network dataset supports turns. If you want to add turns to a network that does not support turns, you will have to create a new network dataset that supports turns.

  • After creating the turn feature class, the turn features can be created in ArcMap using the commands to create linear features on the Editor toolbar.

Syntax

arcpy.na.CreateTurnFeatureClass(out_location, out_feature_class_name, {maximum_edges}, {in_network_dataset}, {in_template_feature_class}, {spatial_reference}, {config_keyword}, {spatial_grid_1}, {spatial_grid_2}, {spatial_grid_3}, {has_z})
ParameterExplanationData Type
out_location

The file, workgroup, or enterprise geodatabase, or the folder in which the output turn feature class will be created. The workspace must already exist.

Workspace;Feature Dataset
out_feature_class_name

The name of the turn feature class to be created.

String
maximum_edges
(Optional)

The maximum number of edges that turns in the new turn feature class can model. The default value is 5. The maximum value is 50.

Long
in_network_dataset
(Optional)

The network dataset in which the turn feature class will participate. The resulting turn feature class will be added as a turn source to the network dataset. If no network dataset is specified, the turn feature class will be created as not participating in a network dataset.

Network Dataset Layer
in_template_feature_class
(Optional)

The feature class used as a template to define the attribute schema of the new turn feature class.

If the template feature class has the following fields, they are not created on the output turn feature class; NODE_, NODE#, JUNCTION, F_EDGE, T_EDGE, F-EDGE, T-EDGE, ARC1_, ARC2_, ARC1#, ARC2#, ARC1-ID, ARC2-ID, AZIMUTH, ANGLE.

Feature Layer
spatial_reference
(Optional)

The spatial reference to be applied to the output turn feature class. This parameter is ignored if the output location is a geodatabase feature dataset, as the output turn feature class will inherit the spatial reference of the feature dataset.

If you want to import the spatial reference from an existing feature class, specify its path as the parameter value.

Spatial Reference
config_keyword
(Optional)

Specifies the configuration keyword that determines the storage parameters of the new turn feature class. This parameter is used only if the output location is an workgroup or enterprise geodatabase

String
spatial_grid_1
(Optional)

This parameter has been deprecated in ArcGIS Pro. Any value you enter is ignored.

Double
spatial_grid_2
(Optional)

This parameter has been deprecated in ArcGIS Pro. Any value you enter is ignored.

Double
spatial_grid_3
(Optional)

This parameter has been deprecated in ArcGIS Pro. Any value you enter is ignored.

Double
has_z
(Optional)
  • ENABLEDThe coordinates in the new turn feature class will have elevation (Z) values. This value should be used if the input network dataset is specified and it supports connectivity based on z coordinate values of the network sources.
  • DISABLEDThe coordinates in the new turn feature class will not have elevation (Z) values.
Boolean

Derived Output

NameExplanationData Type
out_turn_features

New turn feature class with turn features.

Feature Class

Code sample

CreateTurnFeatureClass example 1 (Python window)

Execute the tool using only the required parameters.

out_loc = "C:/Data/SanFrancisco.gdb/Transportation"
arcpy.na.CreateTurnFeatureClass(out_loc, "DelayTurns")
CreateTurnFeatureClass example 2 (Python window)

Execute the tool using all parameters.

out_loc = "C:/Data/SanFrancisco.gdb/Transportation"
network = "C:/Data/SanFrancisco.gdb/Transportation/Streets_ND"
template = "C:/Data/schema.gdb/TurnTemplate"
arcpy.na.CreateTurnFeatureClass(out_loc, "DelayTurns", 2, network, template, "",
                                "", 0, 0, 0, "DISABLED")
CreateTurnFeatureClass example 3 (stand-alone script)

The following Python script demonstrates how to use the CreateTurnFeatureClass tool in a stand-alone script.

# Name: CreateTurnFeatureClass_ex03.py
# Description: Create a new turn feature class associated with a 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
inFeatureDataset = "Transportation"
outTurnFeatureClassName = "DelayTurns"
maxEdges = 3
inNetworkDataset = inFeatureDataset + "/" + "Streets_ND"

#Create a turn feature class and add it as a turn source by specifying the
#network dataset
arcpy.CreateTurnFeatureClass_na(inFeatureDataset,outTurnFeatureClassName,
                                maxEdges, inNetworkDataset)

print("Script completed successfully.")

Licensing information

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

Related topics