# Name: GenerateIntersections_Pro_ex3_fs.py
# Description: Generates and updates intersections in an existing feature service.
# Requires: ArcGIS Location Referencing
# Import arcpy module
import arcpy
# Check out license
arcpy.CheckOutExtension("LocationReferencing")
# Input LRS route network and intersection feature class are in feature service. Signing in portal is required to access the feature service.
arcpy.SignInToPortal('https://yourdomain.com/portal', 'username', 'password')
# Local variables
in_intersection_feature_class = r"https://yourdomain.com/server/rest/services/FeatureServiceName/FeatureServer/1"
in_network_layer = r"https://yourdomain.com/server/rest/services/FeatureServiceName/FeatureServer/1"
start_date = "5/5/2020"
edited_by_current_user = "CURRENT_USER"
# Execute the tool
arcpy.locref.GenerateIntersections(in_intersection_feature_class, in_network_layer, start_date, edited_by_current_user)
# Check in license
arcpy.CheckInExtension('LocationReferencing')