ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Core.Data.LinearReferencing Namespace / RouteInfo Class / LocateFeatures Method / LocateFeatures(Selection,Double,EventTableConfiguration) Method
Selected features to intersect with RouteInfo.
The search radius defines how far a search will be done to find a target route.
Describes an event table to hold events information.
Example

In This Topic
    LocateFeatures(Selection,Double,EventTableConfiguration) Method
    In This Topic
    Computes the intersection between selected features and route features and then stores the resulting route and measure information in a new event table as described by eventTableConfiguration.The search radius defines how far a search will be done to find a target route.
    Syntax

    Parameters

    selectedFeatures
    Selected features to intersect with RouteInfo.
    searchRadius
    The search radius defines how far a search will be done to find a target route.
    eventTableConfiguration
    Describes an event table to hold events information.
    Exceptions
    ExceptionDescription
    A geodatabase-related exception has occurred.
    eventTableConfiguration is null.
    Remarks

    If the featureClass is points, the searchRadius will be a numeric value defining how far around each point a search will be done to find a target route.

    If the featureClass is lines, the searchRadius will be a cluster tolerance, which is a numeric value representing the maximum tolerated distance between the input lines and the target routes.

    If the featureClass is polygons, the searchRadius is ignored and no search radius will be used.

    Example
    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