Locate Features Along Routes

Title  Locate Features Along Routes

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


Syntax

Parameter Explanation
in_features

The input point, line, or polygon features.

in_routes

The routes with which the input features will be intersected.

route_id_field

The field containing values that uniquely identify each route. This field can be numeric or character.

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.

out_table

The table to be created.

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 Identifier Field—The field that will contain values that indicate along which route each event is.
  • Event Type—The type of events the output event table will contain (POINT or LINE).
    • POINT—Point events occur at a precise location along a route. Only a single measure field must be specified.
    • LINE—Line events define a portion of a route. Both from- and to-measure fields must be specified.
  • From-Measure Field—A field that will contain measure values. Required when the event type is POINT or LINE. Note when the Event Type is POINT, the label for this parameter becomes Measure Field.
  • To-Measure Field—A field that will contain measure values. Required when the event type is LINE.
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.

  • Checked—Only the closest route location will be written to the output event table. This is the default.
  • Unchecked—Every route location (within the search radius) will be written to the output event table.
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.

  • Checked—A field containing the point-to-route distance will be added to the output event table. This is the default.
  • Unchecked—A field containing the point-to-route distance will not be added to the output event table.
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.

  • Checked—Zero length line events will be written to the output event table. This is the default.
  • Unchecked—Zero length line events will not be written to the output event table.
in_fields (Optional)

Specifies whether the output event table will contain route location fields plus all the attributes from the input features.

  • Checked—The output event table will contain route location fields plus all the attributes from the input features. This is the default.
  • Unchecked—The output event table will only contain route location fields plus the ObjectID field from the input features.
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 the distance_field parameter value DISTANCE is specified.

  • Checked—The distance values in the output event table will be calculated based on the routes' M direction. Input features to the left of the M Direction of the route will be assigned a positive offset (+), and features to the right of the M Direction will be assigned a negative offset value (-). This is the default.
  • Unchecked—The distance values in the output event table will be calculated based on the routes' digitized direction. Input features to the left of the digitized direction of the route will be assigned a negative (-) offset, and features to the right of the digitized direction will be assigned a positive offset value (+).

Code Samples

LocateFeaturesAlongRoutes example 1 (Python window)

The following Python script demonstrates how to use the LocateFeaturesAlongRoutes function in the Python window


import arcpy
from arcpy import env

env.workspace = "C:/Data"
arcpy.LocateFeaturesAlongRoutes_lr("rail_segments.shp", "rail_routes.shp", "rkey", "0.5 Feet", "locate_lines", "rkey LINE fmp tmp")

 
                    

LocateFeaturesAlongRoutes example 2 (stand-alone Python script)

The following Python script demonstrates how to use the LocateFeaturesAlongRoutes function in a stand-alone Python script.


# Name: LocateFeaturesAlongRoutes_Example1.py
# Description: Locate shapefile lines along shapefile routes.


# Import system modules
import arcpy
from arcpy import env

# Set workspace
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)

 
                    

LocateFeaturesAlongRoutes example 3 (stand-alone Python script)

The following Python script demonstrates how to use the LocateFeaturesAlongRoutes function in a stand-alone Python script using file geodatabase data.


# Name: LocateFeaturesAlongRoutes_Example2.py
# Description: Locate personal geodatabase points along file geodatabase routes.


# Import system modules 
import arcpy
from arcpy import env

# Set workspace
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)
 

                    

LocateFeaturesAlongRoutes example 4 (stand-alone Python script)

The following Python script demonstrates how to use the LocateFeaturesAlongRoutes function in a stand-alone Python script using personal geodatabase data.


# Name: LocateFeaturesAlongRoutes_Example3.py
# Description:  Locate personal geodatabase points along personal geodatabase routes.


# Import system modules
import arcpy
from arcpy import env

# Set workspace
env.workspace = "C:/Data/Pitt.mdb"

# 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)
 

                    

LocateFeaturesAlongRoutes example 5 (stand-alone Python script)

The following Python script demonstrates how to use the LocateFeaturesAlongRoutes function in a stand-alone Python script using SDE data.


# Name: LocateFeaturesAlongRoutes_Example4.py
# Description:  Locate enterprise geodatabase polygons along enterprise geodatabase routes.

 
# Import system modules
import arcpy
from arcpy import env

# Set workspace
env.workspace = "Database Connections/Connection to Jerry.sde"

# Set local variables
feats = gp.QualifyTableName("counties", wkspc)      # standalone feature class
rts = gp.QualifyTableName("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_DIRECTION")

                    

Tags

Credits

Use limitations