Available with Network Analyst license.
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
CreateTurnFeatureClass_na (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})
Parameter | Explanation | Data Type |
out_location | The file, personal, workgroup, or enterprise geodatabase, or the folder in which the output turn feature class will be created. This 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) |
The Spatial Grid 1, 2, and 3 parameters are used to compute a spatial index and only apply to file geodatabases and certain workgroup and enterprise geodatabase feature classes. If you are unfamiliar with setting grid sizes, leave these options as 0,0,0 and ArcGIS will compute optimal sizes for you. Since no features are written by this tool, the spatial index will be in an unbuilt state. The index will be built when features are written to the feature class such as by the Append tool or editing operations. For more information about this parameter, refer to the Add Spatial Index tool documentation. | Double |
spatial_grid_2 (Optional) |
Cell size of the second spatial grid. Leave the size at 0 if you only want one grid. Otherwise, set the size to at least three times larger than Spatial Grid 1. | Double |
spatial_grid_3 (Optional) |
Cell size of the third spatial grid. Leave the size at 0 if you only want two grids. Otherwise, set the size to at least three times larger than Spatial Grid 2. | Double |
has_z (Optional) |
| Boolean |
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 Python 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
import os
#Check out the Network Analyst extension license
arcpy.CheckOutExtension("Network")
#Set environment settings
env.workspace = "C:/Data/SanFrancisco.gdb"
#Set local variables
feature_dataset = "Transportation"
turn_feature_class_name = "DelayTurns"
max_edges = 3
network = feature_dataset + "/Streets_ND"
#Create a turn feature class and add it as a turn source by specifying the
#network dataset
arcpy.na.CreateTurnFeatureClass(feature_dataset, turn_feature_class_name,
max_edges, network)
print("Script completed successfully.")
Environments
Licensing information
- ArcGIS Desktop Basic: Yes
- ArcGIS Desktop Standard: Yes
- ArcGIS Desktop Advanced: Yes