# Name: GenerateRoutes_Pro_Ex3.py
# Description: Generate routes in stand-alone mode using a feature service. It is recommended to work in a version and post it into the default version.
# Requires: ArcGIS Location Referencing
# Import arcpy module
import arcpy
# Check out license
arcpy.CheckOutExtension("LocationReferencing")
# Input LRS route network is in feature service. Signing into portal is required to access the feature service.
arcpy.SignInToPortal('https://yourdomain.com/portal', 'username', 'password')
# Map the input LRS route network from the feature service. Here, 1 corresponds to the input LRS route network.
in_route_features = r"https://yourdomain.com/server/rest/services/FeatureServiceName/FeatureServer/1"
# Process : Generate Routes.
arcpy.locref.GenerateRoutes(in_route_features)
# Check in license
arcpy.CheckInExtension('LocationReferencing')