Select to view content in your preferred language

How to perform Network Analyst and Spatial Analyst operations programmatically in ArcGIS Pro SDK?

140
2
Jump to solution
Thursday
Labels (3)
rdc_hirohara
Occasional Contributor

Hello,

In ArcMap/ArcObjects, it was possible to perform Network Analyst operations programmatically using the
ESRI.ArcGIS.NetworkAnalyst namespace.
For example, we could:

  • Add stops (facilities) dynamically

  • Run a route solve

  • Repeat this process many times in a loop

  • Build custom analyses such as Huff models or network-based Voronoi diagrams
    by directly interacting with the NAContext, INAClass, network dataset, and solver objects.


Now, in ArcGIS Pro, I am trying to migrate the same functionality, but:

  • I cannot find any equivalent Network Analyst API (classes or methods) in the ArcGIS Pro SDK for .NET.

  • The Pro SDK documentation appears to expose only Geoprocessing (GP)-based tools, and not the internal NA objects.

  • Spatial Analyst also seems to be available only through GP tools (arcpy.sa), not via API objects.


My question:

Is there any supported way in ArcGIS Pro SDK (or ArcPy) to programmatically perform Network Analyst operations, such as:

  • Dynamically adding stops/facilities

  • Running route/service area solves repeatedly inside a loop

  • Accessing the network dataset, edges, nodes, or solver context

  • Implementing custom network-based analyses (e.g., Huff model, network Voronoi, weighted network Voronoi)

Or, is the only supported approach in ArcGIS Pro to use Geoprocessing tools (MakeServiceAreaLayer, Solve, OD Cost Matrix, etc.)?


Additional context:

I am migrating a large ArcObjects application that makes heavy use of:

  • Network Analyst

  • Spatial Analyst

  • Custom iterative network analysis

  • Facility → shortest path computations

  • Real-time update of barriers and attributes

so I want to understand the technical limitations of ArcGIS Pro SDK and the recommended architecture for replacing these workflows.


Thank you for any guidance from the Pro SDK / Network Analyst team.

0 Kudos
1 Solution

Accepted Solutions
rdc_hirohara
Occasional Contributor

I was able to resolve this.

I confirmed that I can run Network Analyst Route analysis from an ArcGIS Pro add-in by calling the following geoprocessing tools from C#:

na.MakeRouteAnalysisLayer to create the route analysis layer

na.AddLocations to add input points to the 「ストップ」 (Stops) sublayer

na.Solve to perform the route calculation

I tested this in a loop using two different feature classes (stop1 and stop2), each containing two points.
For each iteration, I call na.AddLocations and then na.Solve, and I can then copy the resulting route feature from the 「ルート」 layer to my own output feature classes.

With this workflow, I can repeatedly perform route analysis from the ArcGIS Pro SDK without using ArcPy, so my original question is resolved.

Thank you to everyone who viewed the thread.

View solution in original post

0 Kudos
2 Replies
rdc_hirohara
Occasional Contributor

I found that it might be possible to accomplish what I need by using the following geoprocessing tools:

Add Locations
https://pro.arcgis.com/en/pro-app/latest/tool-reference/network-analyst/add-locations.htm

Solve
https://pro.arcgis.com/ja/pro-app/latest/tool-reference/network-analyst/solve.htm

I will try these tools to see if I can perform the Network Analyst operations from the ArcGIS Pro SDK.

0 Kudos
rdc_hirohara
Occasional Contributor

I was able to resolve this.

I confirmed that I can run Network Analyst Route analysis from an ArcGIS Pro add-in by calling the following geoprocessing tools from C#:

na.MakeRouteAnalysisLayer to create the route analysis layer

na.AddLocations to add input points to the 「ストップ」 (Stops) sublayer

na.Solve to perform the route calculation

I tested this in a loop using two different feature classes (stop1 and stop2), each containing two points.
For each iteration, I call na.AddLocations and then na.Solve, and I can then copy the resulting route feature from the 「ルート」 layer to my own output feature classes.

With this workflow, I can repeatedly perform route analysis from the ArcGIS Pro SDK without using ArcPy, so my original question is resolved.

Thank you to everyone who viewed the thread.

0 Kudos