Create LRS Event (Location Referencing)

Summary

Creates line or point events for an existing LRS Network.

Usage

  • The output of the tool is a feature class.

  • Derived networks cannot be used as parent networks.

  • The event feature class fields have properties outlined in the ArcGIS Pipeline Referencing events data model and in the ArcGIS Roads and Highways events data model.

  • The following event behavior rules are set by default:

    ActivityRules

    Calibrate Route

    Stay Put

    Retire Route

    Stay Put

    Extend Route

    Stay Put

    Reassign Route

    Stay Put

    Realign Route

    Stay Put

    Carto Realign Route

    Honor Route Measure

Syntax

arcpy.locref.CreateLRSEvent(parent_network, event_name, {geometry_type}, event_id_field, route_id_field, from_date_field, to_date_field, loc_error_field, measure_field, {to_measure_field}, {event_spans_routes}, {to_route_id_field}, {store_route_name}, {route_name_field}, {to_route_name_field})
ParameterExplanationData Type
parent_network

The network to which the event is registered.

Feature Layer
event_name

The event to be registered.

String
geometry_type
(Optional)

The geometry type of the output event.

  • POINTThe geometry type of the event is Point. This is the default.
  • LINEThe geometry type of the event is Polyline.
String
event_id_field

The event ID field available in the event feature class.

String
route_id_field

Name of the route ID field if it is a point event that does not span routes, or from route ID field if the event_spans_routes parameter is set to SPANS_ROUTES.

String
from_date_field

The from date field available in the event feature class.

String
to_date_field

The to date field available in the event feature class.

String
loc_error_field

The location error field available in the event feature class.

String
measure_field

Name of the measure field if it is a point event or from measure field if it is a line event.

String
to_measure_field
(Optional)

Name of the to measure field. Required only for Line events.

String
event_spans_routes
(Optional)

Specifies whether the event records spans routes.

  • SPANS_ROUTESThe event records span routes.
  • NO_SPANS_ROUTESThe event records do not span routes. This is the default.
Boolean
to_route_id_field
(Optional)

Name of the to route ID field. Required only if the geometry_type parameter is set to LINE and the event_span_routes parameter is set to SPANS_ROUTES.

String
store_route_name
(Optional)

Specifies whether the route name should be stored with the event records.

  • STORE_ROUTE_NAMEStores the route name with the event records.
  • NO_STORE_ROUTE_NAMEDoes not store the route name with the event records. This is the default.
Boolean
route_name_field
(Optional)

The route name field if it is a point event that does not span routes, or the from route name field if it is a line event that spans routes. Required if STORE_ROUTE_NAME is set.

String
to_route_name_field
(Optional)

The to route name field for line events that span routes. Required if STORE_ROUTE_NAME is set.

String

Derived Output

NameExplanationData Type
out_feature_class

The updated event feature layer.

Feature Layer

Code sample

CreateLRSEvent example 1 (Python window)

The following script demonstrates how to use the CreateLRSEvent tool in the Python window.

# Name: Create_LRS_Event_ex1.py
# Description: Create a new LRS Event registered to an LRS Network in the Python window.
# Requires: ArcGIS Location Referencing 

# Check out license
arcpy.CheckOutExtension("LocationReferencing")

# Tool variables
parent_network = r"C:/data.gdb/LRS/Network"
event_name = "Event1"
geometry_type = "LINE"
event_id_field = "EventID"
route_id_field = "FromRouteId"
from_date_field = "FromDate"
to_date_field = "ToDate"
loc_error_field = "LocationError"
measure_field = "FromMeasure"
to_measure_field = "ToMeasure"
event_spans_routes = "SPANS_ROUTES"
to_route_id_field = "ToRouteId"
store_route_name = "STORE_ROUTE_NAME"
route_name_field = "FromRouteName"
to_route_name_field = "ToRouteName"

# set current workspace
arcpy.env.workspace = "C:/data.gdb"

# execute the tool
arcpy.locref.CreateLRSEvent(parent_network, event_name, geometry_type, event_id_field, route_id_field, from_date_field,
                            to_date_field, loc_error_field, measure_field, to_measure_field, event_spans_routes,
                            to_route_id_field, store_route_name, route_name_field, to_route_name_field)

# Check in license
arcpy.CheckInExtension('LocationReferencing')
CreateLRSEvent example 2 (stand-alone script)

The following script demonstrates how to use the CreateLRSEvent tool in a stand-alone Python script.

# Name: Create_LRS_Event_ex2.py
# Description: Create a new LRS Event registered to an LRS Network in this stand-alone script.
# Requires: ArcGIS Location Referencing 

# Import arcpy module
import arcpy 

# Check out license
arcpy.CheckOutExtension("LocationReferencing")

# Local variables 
parent_network = r"C:/data.gdb/LRS/Network"
event_name = "Event1"
geometry_type = "LINE"
event_id_field = "EventID"
route_id_field = "FromRouteId"
from_date_field = "FromDate"
to_date_field = "ToDate"
loc_error_field = "LocationError"
measure_field = "FromMeasure"
to_measure_field = "ToMeasure"
event_spans_routes = "SPANS_ROUTES"
to_route_id_field = "ToRouteId"
store_route_name = "STORE_ROUTE_NAME"
route_name_field = "FromRouteName"
to_route_name_field = "ToRouteName"

# Process:  Create LRS Event From Existing Dataset
arcpy.CreateLRSEvent_locref(parent_network, event_name, geometry_type, event_id_field, route_id_field, from_date_field,
                            to_date_field, loc_error_field, measure_field, to_measure_field, event_spans_routes,
                            to_route_id_field, store_route_name, route_name_field, to_route_name_field)

# Check in license
arcpy.CheckInExtension('LocationReferencing')

Environments

This tool does not use any geoprocessing environments.

Licensing information

  • Basic: Requires ArcGIS Location Referencing
  • Standard: Requires ArcGIS Location Referencing
  • Advanced: Requires ArcGIS Location Referencing

Related topics