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
Parameter | Explanation | Data Type |
out_location |
The ArcSDE, file, or personal 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 20. | 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 ArcSDE 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 ArcSDE 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
Execute the tool using only the required parameters
import arcpy arcpy.env.workspace = "C:/ArcTutor/Network Analyst/Tutorial/SanFrancisco.gdb" arcpy.CreateTurnFeatureClass_na("Transportation","DelayTurns")
Execute the tool using all parameters
import arcpy arcpy.env.workspace = "C:/ArcTutor/Network Analyst/Tutorial/SanFrancisco.gdb" arcpy.CreateTurnFeatureClass_na("Transportation","DelayTurns",2, "Transportation/Streets_ND", "C:/Data/schema.gdb/TurnTemplate","","",0,0,0, "DISABLED")
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 # Author: ESRI #Import system modules import arcpy from arcpy import env #Check out the Network Analyst extension license arcpy.CheckOutExtension("Network") #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."