Skip To Content

Choosing between the modules (arcpy.na and arcpy.nax)

ArcGIS Pro includes two modules that allow you to perform network analysis using Python, a new module, arcpy.nax introduced at ArcGIS Pro 2.4, and the legacy module, arcpy.na. While both modules are supported, the 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 following are advantages of the arcpy.nax module:

  • The overall execution time for the analysis is significantly faster. This is mainly due to arcpy.nax storing all intermediate data in memory instead of writing it to feature classes on disk.
  • arcpy.nax provides easy-to-use objects to write your Python scripts that perform network analysis.

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

The following are examples of when you should use the legacy arcpy.na module:

  • You have an ArcGIS Pro project that contains network analysis layers, and your goal is to update analysis settings stored in these layers and solve the analysis. In such a case, you must use the arcpy.na module because the arcpy.nax module does not support updating the settings of the network analysis layers or solving network analysis layers.
  • You are automating the process of publishing a map service with network analysis capability to your ArcGIS Server site. This workflow requires that you create one or more network analysis layers, add the layers to a map in your project, and share the map as a service. You can create network analysis layers in the arcpy.na module; you cannot in the arcpy.nax module.