ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Core.Data.LinearReferencing Namespace / LineEventInfo Class / LineEventInfo Constructor / LineEventInfo Constructor(Table,String,String,String)
The table that contains line events.
The name of the field that contains the route identifier associated with each event.
The name of the field that identifies where the event starts within the route.
The name of the field that identifies where the event ends within the route.
Example

In This Topic
    LineEventInfo Constructor(Table,String,String,String)
    In This Topic
    Initializes a new instance of the LineEventInfo class.
    Syntax

    Parameters

    lineEventTable
    The table that contains line events.
    routeIDFieldName
    The name of the field that contains the route identifier associated with each event.
    fromMeasureFieldName
    The name of the field that identifies where the event starts within the route.
    toMeasureFieldName
    The name of the field that identifies where the event ends within the route.
    Exceptions
    Example
    Create an events table using the DDL
    public void CreateEvents(SchemaBuilder schemaBuilder)
    {
        FieldDescription routeIdDescription = FieldDescription.CreateIntegerField("RID");
        FieldDescription measureFieldDescription = new FieldDescription("Measure", FieldType.Double);
        FieldDescription offsetFieldDescription = FieldDescription.CreateIntegerField("OffsetValue");
    
        TableDescription eventTableDescription = new TableDescription("LR_EventTable", new List<FieldDescription>() { routeIdDescription, offsetFieldDescription, measureFieldDescription });
        schemaBuilder.Create(eventTableDescription);
        schemaBuilder.Build();
    }
    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);
            }
        }
    }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.3 or higher.
    See Also