ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Core.Data.LinearReferencing Namespace / RouteEventSource Class / RouteEventSource Constructor
The object containing information about the route feature class.
The object containing information about the event table.
The object that specifies options for the route event source.
Example Version

RouteEventSource Constructor
Generates a new route event source feature class using dynamic segmentation.
Syntax

Parameters

routeInfo
The object containing information about the route feature class.
eventInfo
The object containing information about the event table.
routeEventSourceOptions
The object that specifies options for the route event source.
Exceptions
ExceptionDescription
routeInfo, eventInfo or routeEventSourceOptions is null.
A geodatabase-related exception has occurred.
Remarks
The dynamic segmentation process calculates the location (shape) of events stored in an event table. The result of the dynamic segmentation is a dynamic feature class known as a route event source, and it can be used as the data source for further computation.
Example
Create a RouteEventSource via dynamic segmentation process for point events
public void CreatePointEventSource(Geodatabase geodatabase, string routeFeatureClassName = "Roads", string eventTableName = "Accidents", string routeIdFieldName = "RID", string measureFieldName = "Measure")
{
    using (FeatureClass routesFeatureClass = geodatabase.OpenDataset<FeatureClass>(routeFeatureClassName))
    using (Table eventsTable = geodatabase.OpenDataset<Table>(eventTableName))
    {
        RouteInfo routeInfo = new RouteInfo(routesFeatureClass, routeIdFieldName);
        EventInfo eventInfo = new PointEventInfo(eventsTable, routeIdFieldName, measureFieldName);
        RouteEventSourceOptions routeEventSourceOptions = new PointEventSourceOptions(AngleType.Tangent) { ComplementAngle = true };

        using (RouteEventSource routeEventSource = new RouteEventSource(routeInfo, eventInfo, routeEventSourceOptions))
        using (RouteEventSourceDefinition routeEventSourceDefinition = routeEventSource.GetDefinition())
        {
            // Locating errors 
            IReadOnlyList<RouteEventSourceError> errors = routeEventSource.GetErrors();

            // Route event source fields 
            IReadOnlyList<Field> routeEventSourceFields = routeEventSourceDefinition.GetFields();

            // Add RouteEventSource to the ArcGIS Pro map
            FeatureLayerCreationParams layerParams = new FeatureLayerCreationParams(routeEventSource)
            {
                Name = "RoadAccidents"
            };

            LayerFactory.Instance.CreateLayer<FeatureLayer>(layerParams, MapView.Active.Map);
        }
    }
}
Create a RouteEventSource via dynamic segmentation process for line events
public void CreateLineEventSource(Geodatabase geodatabase, string routeFeatureClassName = "Roads", string eventTableName = "Accidents", string routeIdFieldName = "RID", string toMeasureFieldName = "toMeasure", string fromMeasureFieldName = "fromMeasure", string offsetFieldName = "Offset")
{
    using (FeatureClass routesFeatureClass = geodatabase.OpenDataset<FeatureClass>(routeFeatureClassName))
    using (Table eventsTable = geodatabase.OpenDataset<Table>(eventTableName))
    {
        RouteInfo routeInfo = new RouteInfo(routesFeatureClass, routeIdFieldName);
        EventInfo eventInfo = new LineEventInfo(eventsTable, routeIdFieldName, fromMeasureFieldName, toMeasureFieldName, offsetFieldName);
        RouteEventSourceOptions routeEventSourceOptions = new LineEventSourceOptions() { IsPositiveOffsetOnRight = true };

        using (RouteEventSource routeEventSource = new RouteEventSource(routeInfo, eventInfo, routeEventSourceOptions))
        using (RouteEventSourceDefinition routeEventSourceDefinition = routeEventSource.GetDefinition())
        {
            // Locating errors 
            IReadOnlyList<RouteEventSourceError> errors = routeEventSource.GetErrors();

            // Route event source fields 
            IReadOnlyList<Field> routeEventSourceFields = routeEventSourceDefinition.GetFields();

            // Add RouteEventSource to the ArcGIS Pro map
            FeatureLayerCreationParams layerParams = new FeatureLayerCreationParams(routeEventSource)
            {
                Name = "HighCrashAreas"
            };

            LayerFactory.Instance.CreateLayer<FeatureLayer>(layerParams, MapView.Active.Map);
        }
    }
}
Locate features along routes
public void LocateLineFeaturesAlongRoutes(Geodatabase geodatabase, string routeFeatureClassName = "Roads", string eventTableName = "Accidents", string routeIdFieldName = "RID", string toMeasureFieldName = "toMeasure", string fromMeasureFieldName = "fromMeasure")
{
    // Configure events table
    EventTableConfiguration lineEventTableConfiguration = new LineEventTableConfiguration(eventTableName, routeIdFieldName, fromMeasureFieldName, toMeasureFieldName) { KeepAllFields = true, MDirectionOffset = true };

    using (FeatureClass routeFeatureClass = geodatabase.OpenDataset<FeatureClass>(routeFeatureClassName))
    using (FeatureClass highCrashAreaFeatureClass = geodatabase.OpenDataset<FeatureClass>("HighCrashRegion"))
    {
        RouteInfo routeInfo = new RouteInfo(routeFeatureClass, routeIdFieldName);

        // Creates an event table inside the geodatabase
        routeInfo.LocateFeatures(highCrashAreaFeatureClass, 0.5, lineEventTableConfiguration);

        // Open newly created event table
        using (Table eventTable = geodatabase.OpenDataset<Table>(eventTableName))
        {
            EventInfo eventInfo = new LineEventInfo(eventTable, routeIdFieldName, fromMeasureFieldName, toMeasureFieldName);

            // Create RouteEventSource using new event table
            using (RouteEventSource routeEventSource = new RouteEventSource(routeInfo, eventInfo, new LineEventSourceOptions()))
            {
                // TODO
            }
        }
    }
}
Requirements

Target Platforms: Windows 11, Windows 10

ArcGIS Pro version: 3.4 or higher.
See Also