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); } } }
Target Platforms: Windows 11, Windows 10