# Name: DeriveEventMeasures_Pro_Ex3.py
# Description: Populate and update Derived RouteID and measure values on point and line events with those fields configured and enabled.
# Requires: ArcGIS Location Referencing
# Import arcpy module.
import arcpy
# Check out license
arcpy.CheckOutExtension("LocationReferencing")
## Input LRS Route Network is in feature service. Portal signin is required to access the feature service.
arcpy.SignInToPortal('https://yourdomain.com/portal', 'username', 'password')
## Map the input route network from the feature service. Here, 3 corresponds to the input route network.
in_lrs_network = r"https://yourdomain.com/server/rest/services/FeatureServiceName/FeatureServer/3"
# Set tool variables.
update_all_events = "UPDATE_ALL"
event_layers = ""
# Process : Derive Event Measures.
arcpy.locref.DeriveEventMeasures(in_lrs_network, update_all_events, event_layers)
# Check in license
arcpy.CheckInExtension('LocationReferencing')