Skip To Content

What is the Network Analyst module

The Network Analyst module arcpy.na is a Python module for working with network analysis functionality provided with the ArcGIS Network Analyst extension. It provides access to all the geoprocessing tools available in the Network Analyst toolbox as well as other helper functions and classes that allow you to automate the Network Analyst workflow through Python.

To accomplish your workflow, you will most likely use functions and classes from ArcPy or other modules such as the arcpy.mp module. In particular, the ArcPy Describe function can be used to access read-only properties for a network dataset or a network analysis layer.

ArcGIS Pro 2.4 provides a new module, arcpy.nax, that also allows you to perform network analysis using Python. arcpy.nax module has certain advantages especially if the goal of your analysis is to use feature classes as inputs and export the analysis results as new feature classes.

  • The overall execution time for the analysis is significantly faster. This is mainly due to the fact that the new module keeps all the intermediate data in the memory as opposed to writing it to feature classes on disk.
  • The new module provides easy to use objects to write your Python scripts that perform network analysis.

If you are starting with new scripts that do not have to be supported with versions of ArcGIS Pro prior to 2.4 release, it is highly recommended to use the new arcpy.nax module. However, there can be certain scenarios when you still have to use the legacy arcpy.na module. The ArcGIS Pro application performs network analysis using network analysis layers. These layers store all the inputs and outputs as well as the settings for a given analysis. So if your goal is to automate the workflows performed by the ArcGIS Pro application or you need to work with network analysis layers, you should keep using arcpy.na module as the new arcpy.nax module does not support working with network analysis layers. Below are certain examples that illustrate when you should still use the legacy arcpy.na module.

  • You have an ArcGIS Pro project that contains a few network analysis layers and your goal is to update some analysis settings stored in these layers and then solve the analysis. In such a case, you have to use arcpy.na module as arcpy.nax module has no support for updating the settings of the network analysis layers or solving network analysis layers.
  • You are trying to automate the process of publishing a map service with network analysis capability to your ArcGIS Server site. This workflow requires you to create one or more network analysis layers, add the layers to a map in your project and then share the map as a service. The ability to create new network analysis layers is only available in arcpy.na module.