Summary
Computes the intersection of input features (point, line, or polygon) and route features and writes the route and measure information to a new event table.
Usage
The output table can be a dBASE file or a geodatabase table.
The event type must be Point when the Input Features are points and must be Line when the input features are lines or polygons.
The best results will be achieved when the input features and the target routes closely overlay.
Caution:
Using a large search radius or cluster tolerance to overcome discrepancies between the input features and target routes can produce unexpected results.
To reduce the number of input features that will be processed by this tool, you can input layers that have selections.
-
The output table can be displayed in a map using the Make Route Event Layer tool.
Syntax
arcpy.lr.LocateFeaturesAlongRoutes(in_features, in_routes, route_id_field, radius_or_tolerance, out_table, out_event_properties, {route_locations}, {distance_field}, {zero_length_events}, {in_fields}, {m_direction_offsetting})
Parameter | Explanation | Data Type |
in_features | The input point, line, or polygon features. | Feature Layer |
in_routes | The routes with which the input features will be intersected. | Feature Layer |
route_id_field | The field containing values that uniquely identify each route. This field can be numeric or character. | Field |
radius_or_tolerance | If the input features are points, the search radius is a numeric value defining how far around each point a search will be done to find a target route. If the input features are lines, the search tolerance is really a cluster tolerance, which is a numeric value representing the maximum tolerated distance between the input lines and the target routes. If the input features are polygons, this parameter is ignored and no search radius is used. | Linear Unit |
out_table | The table to be created. | Table |
out_event_properties | Parameter consisting of the route location fields and the type of events that will be written to the output event table.
| Route Measure Event Properties |
route_locations (Optional) | When locating points along routes, it is possible that more than one route may be within the search radius of any given point. This parameter is ignored when locating lines or polygons along routes.
| Boolean |
distance_field (Optional) | Specifies whether a field named DISTANCE will be added to the output event table. The values in this field are in the units of the specified search radius. This parameter is ignored when locating lines or polygons along routes.
| Boolean |
zero_length_events (Optional) | When locating polygons along routes, it is possible that events can be created where the from-measure is equal to the to-measure. This parameter is ignored when locating points or lines along routes.
| Boolean |
in_fields (Optional) | Specifies whether the output event table will contain route location fields plus all the attributes from the input features.
| Boolean |
m_direction_offsetting (Optional) | Specifies whether the offset distance calculated should be based on the M direction or the digitized direction. Distances are included in the output event table if distance_field="DISTANCE".
| Boolean |
Code sample
The following Python script demonstrates how to use the LocateFeaturesAlongRoutes function in the Python window
import arcpy
arcpy.env.workspace = "C:/Data"
arcpy.LocateFeaturesAlongRoutes_lr("rail_segments.shp", "rail_routes.shp",
"rkey", "0.5 Feet", "locate_lines",
"rkey LINE fmp tmp")
The following Python script demonstrates how to use the LocateFeaturesAlongRoutes function in a stand-alone Python script.
# Name: LocateFeaturesAlongRoutes_Example2.py
# Description: Locate shapefile lines along shapefile routes.
# Import system modules
import arcpy
# Set workspace
arcpy.env.workspace = "C:/Data"
# Set local variables
feats = "rail_segments.shp"
rts = "rail_routes.shp"
rid = "rkey"
tol = "0.5 Feet"
tbl = "locate_lines"
props = "rkey LINE fmp tmp"
# Execute LocateFeaturesAlongRoutes
arcpy.LocateFeaturesAlongRoutes_lr(feats, rts, rid, tol, tbl, props)
The following Python script demonstrates how to use the LocateFeaturesAlongRoutes function in a stand-alone Python script using file geodatabase data.
# Name: LocateFeaturesAlongRoutes_Example3.py
# Description: Locate personal geodatabase points along file geodatabase routes.
# Import system modules
import arcpy
# Set workspace
arcpy.env.workspace = "C:/Data/Pitt.gdb"
# Set local variables
feats = "rail/crossings" # crossings is in the rail feature dataset
rts = "rail/routes" # routes is in the rail feature dataset
rid = "rkey"
rad = "10 Feet"
tbl = "locate_points"
props = "rkey POINT mp"
# Execute LocateFeaturesAlongRoutes
arcpy.LocateFeaturesAlongRoutes_lr(feats, rts, rid, rad, tbl, props)
The following Python script demonstrates how to use the LocateFeaturesAlongRoutes function in a stand-alone Python script using enterprise geodatabase data.
# Name: LocateFeaturesAlongRoutes_Example4.py
# Description: Locate enterprise geodatabase polygons along enterprise geodatabase routes.
# Import system modules
import arcpy
# Set workspace
arcpy.env.workspace = "C:/MyProject/myConn.sde"
# Set local variables
feats = arcpy.ValidateTableName("counties", wkspc) # standalone feature class
rts = arcpy.ValidateTableName("rail_routes", wkspc) # standalone feature class
rid = "rkey"
tbl = "locate_polys"
props = "rkey LINE fmp tmp"
# Execute LocateFeaturesAlongRoutes
arcpy.LocateFeaturesAlongRoutes_lr(feats, rts, rid, "#", tbl, props, "#", "#",
"NO_ZERO", "M_DIRECTON")
Environments
Licensing information
- Basic: Yes
- Standard: Yes
- Advanced: Yes