Select to view content in your preferred language

Creating Route Event Layer programmatically

560
2
Jump to solution
08-21-2023 02:25 PM
azlotin
New Contributor II

I am looking for a way to programmatically create a route event layer from a feature layer and a standalone table added to a map in Pro. The geoprocessing code below executes without errors but the event layer does not get added to the map. If I use the out-of-the-box "Make Route Event Layer" GP tool, the event layer is created as expected.   

List<object> argsMakeLayer = new List<object> { streetLayer.Name, "LINK_ID", eventTable.Name, "Link_ID; LINE; FromMeasure; ToMeasure", "Route_Event_Layer", "MapOffset", "NO_ERROR_FIELD", "NO_ANGLE_FIELD", "NORMAL", "ANGLE", "LEFT", "POINT" };
IGPResult result = await Geoprocessing.ExecuteToolAsync("lr.MakeRouteEventLayer", Geoprocessing.MakeValueArray(argsMakeLayer.ToArray()), null, null, null, GPExecuteToolFlags.None);

Is it possible to make this work using the GP approach above? Alternatively, is there a way to create the event layer without using geoprocessing? 

I am using Pro 2.9. Thanks!

 

0 Kudos
1 Solution

Accepted Solutions
GKmieliauskas
Esri Regular Contributor

Hi,

Try to change GPExecuteToolFlags.None to GPExecuteToolFlags.AddOutputsToMap in Geoprocessing.ExecuteToolAsync.

https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic9375.html 

View solution in original post

2 Replies
GKmieliauskas
Esri Regular Contributor

Hi,

Try to change GPExecuteToolFlags.None to GPExecuteToolFlags.AddOutputsToMap in Geoprocessing.ExecuteToolAsync.

https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic9375.html 

azlotin
New Contributor II

Thanks for the help, that was the problem! 

0 Kudos