Label | Explanation | Data Type |
Input Line Features | The features from which routes will be created. | Feature Layer |
Route Identifier Field | The field containing values that uniquely identify each route. The field can be a numeric, text, or GUID field. | Field |
Output Route Feature Class | The feature class that will be created. The feature class can be a shapefile or a geodatabase feature class. | Feature Class |
Measure Source | Specifies how route measures will be accumulated.
| String |
From-Measure Field (Optional) | A field containing measure values. This parameter is required when the Measure Source parameter value is Values from a single field or Values from two fields. | Field |
To-Measure Field (Optional) | A numeric field containing measure values. This parameter is required when the Measure Source parameter value is Values from two fields. | Field |
Coordinate Priority (Optional) | Specifies the position from which measures will be accumulated for each output route. This parameter is ignored when the Measure Source parameter value is Values from two fields.
| String |
Measure Factor (Optional) | A value multiplied by the measure length of each input line before they are merged to create route measures. The default is 1. | Double |
Measure Offset (Optional) | A value added to the route measures after the input lines have been merged to create a route. The default is 0. | Double |
Ignore spatial gaps (Optional) | Specifies whether spatial gaps will be ignored when calculating the measures on disjointed routes. This parameter is applicable when the Measure Source parameter value is Length of features or Values from a single field.
| Boolean |
Build index (Optional) | Specifies whether an attribute index will be created for the route identifier field that is written to the output route feature class.
| Boolean |
Summary
Creates routes from existing lines. The input line features that share a common identifier will be merged to create a single route.
Usage
The unique values in the Route Identifier Field parameter value are written to the Output Route Feature Class parameter.
Use the Make Feature Layer or Make Query Table tools to reduce the number of lines that will be used to create routes.
If the Output Route Feature Class parameter value will be written to a geodatabase, set the appropriate M Tolerance, M Resolution, and M Domain environments.
When setting the measure source as length of the features to accumulate measures using geometric lengths, 2D and 3D lengths are available. For 2D length values, use the feature length. For 3D length values, create a calculation attribute rule on a new field with insert or update triggers that returns the Length3D ArcGIS Arcade function.
Use the Measure Factor parameter to convert between route measure units. For example, to convert from feet to miles, use a factor of 0.00018939394.
Use the Measure Offset parameter value in applications in which the start measure of each route must be a value other than 0.
The Ignore spatial gaps parameter is not used when the Measure Source parameter is specified as Values from two fields. This is because measure values are based on the From-Measure Field and To-Measure Field parameter values.
When the Measure Source parameter is specified as Length of features or Values from a single field, the Coordinate Priority parameter value is determined by placing the minimum bounding rectangle around the input features that will be merged to create one route.
When the Measure Source parameter is specified as Values from two fields, it is not necessary to specify a coordinate priority because measure direction is implied by the values in the From-Measure Field and To-Measure Field parameters.
An attribute index on the route identifier field speeds up the dynamic segmentation process. If you will be using the Output Route Feature Class parameter value for dynamic segmentation, it is recommended that you create an attribute index.
If any features are rejected by this tool, a text file is created in the temporary file path to store information about those features, for example, C:\Users\patrickb\AppData\Local\Temp\Create_Output0.txt (in which Create_Output is the name of the output route feature class).
The Output has M Values environment setting will be ignored. The Output Route Feature Class parameter value will have m-values (measure values).
Parameters
arcpy.lr.CreateRoutes(in_line_features, route_id_field, out_feature_class, measure_source, {from_measure_field}, {to_measure_field}, {coordinate_priority}, {measure_factor}, {measure_offset}, {ignore_gaps}, {build_index})
Name | Explanation | Data Type |
in_line_features | The features from which routes will be created. | Feature Layer |
route_id_field | The field containing values that uniquely identify each route. The field can be a numeric, text, or GUID field. | Field |
out_feature_class | The feature class that will be created. The feature class can be a shapefile or a geodatabase feature class. | Feature Class |
measure_source | Specifies how route measures will be accumulated.
| String |
from_measure_field (Optional) | A field containing measure values. This parameter is required when the measure_source parameter value is ONE_FIELD or TWO_FIELDS. | Field |
to_measure_field (Optional) | A numeric field containing measure values. This parameter is required when the measure_source parameter value is TWO_FIELDS. | Field |
coordinate_priority (Optional) | Specifies the position from which measures will be accumulated for each output route. This parameter is ignored when the measure_source parameter value is TWO_FIELDS.
| String |
measure_factor (Optional) | A value multiplied by the measure length of each input line before they are merged to create route measures. The default is 1. | Double |
measure_offset (Optional) | A value added to the route measures after the input lines have been merged to create a route. The default is 0. | Double |
ignore_gaps (Optional) | Specifies whether spatial gaps will be ignored when calculating the measures on disjointed routes. This parameter is applicable when the measure_source parameter value is LENGTH or ONE_FIELD.
| Boolean |
build_index (Optional) | Specifies whether an attribute index will be created for the route identifier field that is written to the output route feature class.
| Boolean |
Code sample
The following Python window script demonstrates how to use the CreateRoutes function.
import arcpy
arcpy.env.workspace = "C:/Data"
arcpy.lr.CreateRoutes(base_roads.shp, "route1", "newRoutes", "LENGTH", None, None,
"LOWER_LEFT", 0.00018939394)
The following Python script demonstrates how to use the CreateRoutes function using shapefile data in a stand-alone Python script.
# Description: Create routes from lines. The lines are in a shapefile workspace.
# The LENGTH option will be used to set the measures, and a measure factor
# will be used to convert measure units from feet to miles.
# Import system modules
import arcpy
# Set workspace
arcpy.env.workspace = "C:/Data"
# Set local variables
in_lines = "base_roads.shp"
rid = "route1"
out_routes = "create_output1"
# Run CreateRoutes
arcpy.lr.CreateRoutes(in_lines, rid, out_routes, "LENGTH", None, None,
"LOWER_LEFT", 0.00018939394)
The following Python script demonstrates how to use the CreateRoutes function using file geodatabase data in a stand-alone Python script.
# Description: Create routes from lines. The lines are in a file geodatabase.
# The ONE_FIELD option will be used to set the measures.
# Import system modules
import arcpy
# Set workspace
arcpy.env.workspace = "C:/Data/pitt.gdb"
# Set local variables
in_lines = "roads/base_roads" # base_roads exists in the roads feature dataset
rid = "route1"
m_fld = "len_mile"
out_routes = "roads/create_output2" # Write result to the roads feature dataset
# Run CreateRoutes
arcpy.lr.CreateRoutes(in_lines, rid, out_routes, "ONE_FIELD", m_fld, None,
"LOWER_LEFT")
The following Python script demonstrates how to use the CreateRoutes function in a stand-alone Python script using enterprise geodatabase data.
# Description: Create routes from lines. The lines are in an enterprise
# geodatabase. The TWO_FIELDS option will be used to set the measures.
# Import system modules
import arcpy
# Set workspace
arcpy.env.workspace = "C:/MyProject/myConn.sde"
# Set local variables
# base_roads is a stand-alone feature class
in_lines = arcpy.ValidateTableName("base_roads", wkspc)
rid = "route1"
fr_fld = "begmp1"
to_fld = "endmp1"
out_routes = "create_output3" # Write the result to a stand-alone feature class
# Run CreateRoutes
arcpy.lr.CreateRoutes(in_lines, rid, out_routes, "TWO_FIELDS", fr_fld, to_fld)
Environments
Licensing information
- Basic: Yes
- Standard: Yes
- Advanced: Yes