It took more effort than I originally anticipated but I ended up getting measured routes in an LRS dataset and network, as seen below, from test data generated and processed using the code and output that follows.
# This script is intended to create an empty LRS dataset and load
# the geometries of a test polyline feature class with route IDs (TEXT),
# Route Names (TEXT) and from/to measures (DOUBLE) into it so that an
# LRS Network with those routes can be created
import arcpy
arcpy.env.overwriteOutput = True
# Establish coordinate system and geodatabase to be used
srWGS84 = arcpy.SpatialReference("GCS_WGS_1984")
workingFolder = r"C:\temp"
gdbName = "test"
gdb = r"{0}\{1}.gdb".format(workingFolder,gdbName)
lrsName = "TestLRS"
lrsFD = r"{0}\{1}".format(gdb,lrsName)
testFCName = "testFC"
testFC = r"{0}\{1}".format(lrsFD,testFCName)
testStatsTableName = "testStats"
testStatsTable = r"{0}\{1}".format(gdb,testStatsTableName)
testDissolvedFC = r"{0}{1}".format(testFC,"_Dissolve")
calibrationFC = r"{0}\{1}".format(lrsFD,"Calibration_Point")
centerlineFC = r"{0}\{1}".format(lrsFD,"Centerline")
lrsNetworkName = "testLRSNetwork"
lrsNetworkFC = r"{0}\{1}".format(lrsFD,lrsNetworkName)
redlineFC = r"{0}\{1}".format(lrsFD,"Redline")
centerlineSequenceTable = r"{0}\{1}".format(gdb,"Centerline_Sequence")
newCalibrationPointsFCName = "NewCalibrationPoints"
newCalibrationPointsFC = r"{0}\{1}".format(lrsFD,newCalibrationPointsFCName)
newCalibrationPointsFCTempName = newCalibrationPointsFCName+"Temp"
newCalibrationPointsFCtemp = r"{0}\{1}".format(lrsFD,newCalibrationPointsFCTempName)
uniqueCalibrationPointsFCName = "UniqueCalibrationPoints"
uniqueCalibrationPointsFC = r"{0}\{1}".format(lrsFD,uniqueCalibrationPointsFCName)
# Create empty geodatabase for testing
arcpy.management.CreateFileGDB(workingFolder,gdbName)
# Create empty TestLRS dataset with default names for three feature classes
# (Calibration_Point,Centerline,Redline) and an LRS Hierarchy (TestLRS)
# within it, and three tables (Centerline_Sequence, Lrs_Edit_Log,Lrs_Locks)
print("Creating LRS dataset named {0} in {1}".format(lrsName,gdb))
arcpy.locref.CreateLRS(gdb,lrsName,"Centerline","Calibration_Point",
"Redline","Centerline_Sequence",srWGS84)
# Prepare feature class from which routes will be appended into the LRS Network later
# Create empty feature class and its schema
print('Creating "route-ready" polyline feature class ({0}) in LRS dataset ({1})'.format(testFC,lrsFD))
arcpy.management.CreateFeatureclass(lrsFD,"testFC","POLYLINE")
arcpy.management.AddField(testFC,"RouteID","TEXT", None, None, 10)
arcpy.management.AddField(testFC,"RouteName","TEXT", None, None, 10)
arcpy.management.AddField(testFC,"FromMeasure","DOUBLE")
arcpy.management.AddField(testFC,"ToMeasure","DOUBLE")
arcpy.management.AddField(testFC,"FromDate","DATE")
arcpy.management.AddField(testFC,"ToDate","DATE")
# Write three polylines and their route attributes to the feature class
cursor = arcpy.da.InsertCursor(testFC,["SHAPE@","RouteID","RouteName","FromMeasure","ToMeasure"])
array = arcpy.Array([arcpy.Point(0.0,0.0),
arcpy.Point(0.0,1.0)])
polyline = arcpy.Polyline(array,srWGS84)
cursor.insertRow([polyline,"Route1","Route 1",0.0,750.0])
array = arcpy.Array([arcpy.Point(0.0,1.0),
arcpy.Point(1.0,1.0)])
polyline = arcpy.Polyline(array,srWGS84)
cursor.insertRow([polyline,"Route1","Route 1",750.0,2000.0])
array = arcpy.Array([arcpy.Point(1.0,1.0),
arcpy.Point(1.0,0.0)])
polyline = arcpy.Polyline(array,srWGS84)
cursor.insertRow([polyline,"Route2","Route 2",0.0,999.0])
del cursor
arcpy.management.CalculateField(testFC, "FromDate", "datetime.datetime.now()", "PYTHON3", '', "TEXT", "NO_ENFORCE_DOMAINS")
print('Writing statistics from polyline feature class ({0}) into table ({1})'.format(testFC,testStatsTable))
arcpy.analysis.Statistics(testFC,testStatsTable,"FromMeasure MIN;ToMeasure MAX","RouteID")
# Dissolve testFC so that there's only one polyline per route
print("Dissolving {0} primarily on RouteID to create {1}".format(testFC,testDissolvedFC))
arcpy.management.Dissolve(testFC,testDissolvedFC,
"RouteID;RouteName;FromDate;ToDate",
None, "SINGLE_PART", "UNSPLIT_LINES")
arcpy.management.JoinField(testDissolvedFC,"RouteID",testStatsTable,"RouteID","MIN_FromMeasure;MAX_ToMeasure")
# Create empty TestLRSNetwork in TestLRS dataset
print("Creating LRS Network ({0}) in LRS dataset ({1})".format("TestLRSNetwork","TestLRS"))
arcpy.locref.CreateLRSNetwork(gdb, "TestLRS", "TestLRSNetwork",
"RouteID", "RouteName", "FromDate", "ToDate", "DO_NOT_DERIVE", '',
"DO_NOT_INCLUDE",None,None,None,"METERS")
lrsNetworkFC = r"{0}\{1}".format(lrsFD,"TestLRSNetwork")
# Append routes from testFC into TestLRSNetwork which should append them into Centerline feature class at the same time
routeCount = arcpy.management.GetCount(testDissolvedFC)[0]
print("Appending {0} Routes from {1}\n into LRS Network ({2}) in LRS dataset ({3})".format(routeCount,testDissolvedFC,"TestLRSNetwork","TestLRS"))
arcpy.locref.AppendRoutes(testDissolvedFC,lrsNetworkFC, "RouteID", "RouteName", "FromDate", "ToDate",
None,None,None, None, "ADD")
# Generating calibration points and calibrating routes using them
arcpy.locref.GenerateCalibrationPoints(testDissolvedFC,"RouteID","FromDate","ToDate",calibrationFC,
lrsNetworkName, "DIGITIZED_DIRECTION","ATTRIBUTE_FIELDS","MIN_FromMeasure","MAX_ToMeasure")
calPointCount = arcpy.management.GetCount(calibrationFC)[0]
print("Using {0} calibration points to generate measures on routes in LRS Network".format(calPointCount))
arcpy.locref.GenerateRoutes(lrsNetworkFC,"NO_RECORD_CALIBRATION_CHANGES")
# Clean up intermediate data
print(r"Deleting intermediate data")
for itm in [testStatsTableName]:
if arcpy.Exists(r"{0}\{1}".format(gdb,itm)):
print(r"Deleting {0}\{1}".format(gdb,itm))
arcpy.management.Delete(r"{0}\{1}".format(gdb,itm))
for itm in [testFC,testDissolvedFC]:
if arcpy.Exists(itm):
print(r"Deleting {0}".format(itm))
arcpy.management.Delete(r"{0}".format(itm))
Start Time: Tuesday, 5 July 2022 9:45:33 AM
Creating LRS dataset named TestLRS in C:\temp\test.gdb
Creating "route-ready" polyline feature class (C:\temp\test.gdb\TestLRS\testFC) in LRS dataset (C:\temp\test.gdb\TestLRS)
Writing statistics from polyline feature class (C:\temp\test.gdb\TestLRS\testFC) into table (C:\temp\test.gdb\testStats)
Dissolving C:\temp\test.gdb\TestLRS\testFC primarily on RouteID to create C:\temp\test.gdb\TestLRS\testFC_Dissolve
Creating LRS Network (TestLRSNetwork) in LRS dataset (TestLRS)
Appending 2 Routes from C:\temp\test.gdb\TestLRS\testFC_Dissolve
into LRS Network (TestLRSNetwork) in LRS dataset (TestLRS)
Using 4 calibration points to generate measures on routes in LRS Network
Deleting intermediate data
Deleting C:\temp\test.gdb\testStats
Deleting C:\temp\test.gdb\TestLRS\testFC
Deleting C:\temp\test.gdb\TestLRS\testFC_Dissolve
Succeeded at Tuesday, 5 July 2022 9:47:08 AM (Elapsed Time: 1 minutes 34 seconds)
Best Answer
A Roads and Highways implementation requires a minimum schema made up of a Centreline feature class, a route network, calibration points and a centreline sequence table.
For more information on the LRS Data Model here is the Esri Help. https://pro.arcgis.com/en/pro-app/latest/help/production/roads-highways/lrs-data-model.htm
Here are some additional links that might help you get started
2021 User Conference Presentation: https://www.youtube.com/watch?v=z4ztQ54ZsTM
Online Training: https://www.esri.com/training/catalog/621ea031a53818015ee38b4e/arcgis-roads-and-highways%3A-introduction-to-modeling-and-data-management-in-a-desktop-environment/
Online Training: https://www.esri.com/training/catalog/627a8ac4df3f353e516b3de0/arcgis-roads-and-highways%3A-preparing-and-sharing-an-lrs-using-arcgis-enterprise/