Summary
Registers an existing feature class as an LRS event.
Usage
The event feature class must reside in a feature dataset that contains an LRS dataset.
Learn more about the LRS dataset in the Pipeline Referencing data model or the LRS dataset in the Roads and Highways data model.
The event feature class fields must include the properties specified in the Pipeline Referencing events data model or in the Roads and Highways events data model.
The following event behavior rules are set by default:
Activity Rule 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.CreateLRSEventFromExistingDataset(parent_network, in_feature_class, 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})
Parameter | Explanation | Data Type |
parent_network | The network to which the event will be registered. | Feature Layer |
in_feature_class | The event to be registered. | Feature Layer |
event_id_field | The event ID field in the event feature class. | Field |
route_id_field | The route ID field if the feature class is a point event or the from route ID field if the feature class is a line event and event_spans_routes is set to SPANS_ROUTES. | Field |
from_date_field | The from date field in the event feature class. | Field |
to_date_field | The to date field in the event feature class. | Field |
loc_error_field | The location error field in the event feature class. | Field |
measure_field | The measure field if the feature class is a point event or the from measure field if the feature class is a line event. | Field |
to_measure_field (Optional) | The to measure field in the event feature class. This parameter is required for line events. | Field |
event_spans_routes (Optional) | Specifies whether the event records will span routes.
| Boolean |
to_route_id_field (Optional) | The to route ID field for events that span routes. This parameter is required if the in_feature class parameter geometry type is polyline and event_spans_routes is set to SPANS_ROUTES. | Field |
store_route_name (Optional) | Specifies whether the route name will be stored with the event records.
| Boolean |
route_name_field (Optional) | The route name field if the feature class is a point event that doesn't span routes or the from route name field if the feature class is a line event that spans routes. This parameter is required if store_route_name is set to STORE_ROUTE_NAME. | Field |
to_route_name_field (Optional) | The to route name field for line events that span routes. This parameter is required if store_route_name is set to STORE_ROUTE_NAME. | Field |
Derived Output
Name | Explanation | Data Type |
out_feature_class | The updated event feature layer. | Feature Layer |
Code sample
The following script creates an LRS event from an existing dataset using the CreateLRSEventFromExistingDataset function in the Python window.
# Name: CreateLRSNetworkFromExisting_ex5.py
# Description: Create an LRS Event from an existing dataset.
# Requires: ArcGIS Location Referencing
# Check out license
arcpy.CheckOutExtension("LocationReferencing")
# Tool variables
parent_network = r"C:\data.gdb\LRS\Network"
in_feature_class = r"C:\data.gdb\LRS\Event"
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.CreateLRSEventFromExistingDataset_locref(parent_network, in_feature_class, 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')
The following script creates an LRS event from an existing dataset using the CreateLRSEventFromExistingDataset function in a stand-alone Python script.
# Name: Create_LRS_Event_From_Existing_Dataset_ex2.py
# Description: Registers an existing feature class as an event.
# 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"
in_feature_class = r"C:\data.gdb\LRS\Event"
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"
# Execute the tool
arcpy.CreateLRSEventFromExistingDataset_locref(parent_network, in_feature_class, 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
Licensing information
- Basic: Requires ArcGIS Location Referencing
- Standard: Requires ArcGIS Location Referencing
- Advanced: Requires ArcGIS Location Referencing