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 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.
Network Analyst functions
Function | Description |
---|---|
Adds a field to a sublayer of a network analysis layer. | |
Adds network analysis objects to a network analysis layer. The objects are added to specific sublayers such as Stops and Barriers. Objects are input as features or records. | |
Reconstructs the network connectivity and attribute information of a network dataset. The network dataset needs to be rebuilt after making edits to the attributes or the features of a participating source feature class. After the source features are edited, the tool establishes the network connectivity only in the areas that have been edited to speed up the build process; however, when the network attributes are edited, the entire extent of the network dataset is rebuilt. This may be a slow operation on a large network dataset. | |
Adds fields to the input features that contain the network location of the features. The tool is used to store the network location information as feature attributes to quickly load the features as inputs for a network analysis layer. | |
Returns a Boolean indicating whether the number of edge source features from the specified network dataset that are intersected by the features within the specified feature layer is less than or equal to the specified cutoff. If the number of intersecting features is less than or equal to the allowed limit, the function returns True. If the number of intersecting features exceeds the allowed limit, the function returns False. The function is useful to restrict the number of features that can be loaded as line or polygon barriers into a network analysis layer. | |
Creates two feature classes and a table, which together contain information about the edges, junctions, and turns that are traversed while solving a network analysis layer. | |
Creates a new network dataset with the schema contained in the input template file (.xml). All the feature classes and input tables required for creating the network dataset must already exist before this tool is executed. | |
Creates a file containing the schema of an existing network dataset. This template file can then be used to create a new network dataset with the same schema. | |
Creates a new turn feature class to store turn features that model turning movements in a network dataset. | |
Generates turn-by-turn directions from a network analysis layer with routes. The directions can be written to a file in text, XML, or HTML format. If you provide an appropriate stylesheet, the directions can be written to any other file format. | |
Creates a network dataset that minimizes the number of line features required to correctly model the input network dataset. The more efficient output network dataset reduces the time required to solve analyses, draw results, and generate driving directions. This tool outputs a new network dataset and source feature classes; the input network dataset and its source features remain unchanged. | |
Creates a feature class of route lines on the map and corresponding text directions generated by solving a network analysis layer. The output can be modified using the StreetDirectionProperties object of the network analysis layer. | |
Returns a dictionary of network analysis class names from the network analysis layer specified as argument. The dictionary keys are the network analysis class names, and the values are the layer names that reference the network analysis classes from the network analysis layer. The layer names are used as input in some geoprocessing tools such as Add Locations and Add Field To Analysis Layer. | |
Returns a Network Analyst solver properties object based on the type of the network analysis layer specified as the argument. The solver properties object is used to update the analysis properties for the layer. | |
Returns a dictionary of travel mode objects that are available with the network data source. The dictionary keys are the names of the travel modes, and the dictionary values are the travel mode objects. The travel mode objects can be used to update a solver properties object (RouteSolverProperties, ClosestFacilitySolverProperties, ServiceAreaSolverProperties, ODCostMatrixSolverProperties, or LocationAllocationSolverProperties) before solving a particular analysis. | |
Get information such as the description of the network dataset used for the analysis and the execution limits for a tool in the routing utility services registered with your portal. | |
Increases the maximum number of edges per turn in a turn feature class. | |
Returns a list of the languages in which you can generate directions for the routes you create during network analysis. The list of available languages depends on which directions language packs you have installed on your machine. | |
Returns a list of the available styles for generating directions from a route created during network analysis. Each directions style is appropriate for a different application. | |
Makes a closest facility network analysis layer and sets its analysis properties. A closest facility analysis layer is useful in determining the closest facility or facilities to an incident based on a specified travel mode. The layer can be created using a local network dataset or using a service hosted online or in a portal. | |
Makes a closest facility network analysis layer and sets its analysis properties. A closest facility analysis layer is useful in determining the closest facility or facilities to an incident based on a specified network cost. Note: | |
Makes a location-allocation network analysis layer and sets its analysis properties. A location-allocation analysis layer is useful for choosing a given number of facilities from a set of potential locations such that a demand will be allocated to facilities in an optimal and efficient manner. The layer can be created using a local network dataset or using a service hosted online or in a portal. | |
Makes a location-allocation network analysis layer and sets its analysis properties. A location-allocation analysis layer is useful for choosing a given number of facilities from a set of potential locations such that a demand will be allocated to facilities in an optimal and efficient manner. Note: | |
Makes an origin–destination (OD) cost matrix network analysis layer and sets its analysis properties. An OD cost matrix analysis layer is useful for representing a matrix of costs going from a set of origin locations to a set of destination locations. The layer can be created using a local network dataset or a service hosted online or in a portal. | |
Makes an origin–destination (OD) cost matrix network analysis layer and sets its analysis properties. An OD cost matrix analysis layer is useful for representing a matrix of costs going from a set of origin locations to a set of destination locations. Note: | |
Makes a route network analysis layer and sets its analysis properties. A route analysis layer is useful for determining the best route between a set of network locations based on a specified network cost. The layer can be created using a local network dataset or using a routing service hosted online or in a portal. | |
Makes a route network analysis layer and sets its analysis properties. A route analysis layer is useful for determining the best route between a set of network locations based on a specified network cost. Note: | |
Makes a service area network analysis layer and sets its analysis properties. A service area analysis layer is useful in determining the area of accessibility within a given cutoff cost from a facility location. The layer can be created using a local network dataset or using a routing service hosted online or in a portal. | |
Makes a service area network analysis layer and sets its analysis properties. A service area analysis layer is useful in determining the area of accessibility within a given cutoff cost from a facility location. Note: | |
Creates and populates additional fields on the turn feature classes that reference the edges by alternate IDs. The alternate IDs allow for another set of IDs that can help maintain the integrity of the turn features in case the source edges are being edited. | |
Solves the network analysis layer problem based on its network locations and properties. | |
Creates a vehicle routing problem (VRP) network analysis layer, sets the analysis properties, and solves the analysis, which is ideal for setting up a VRP web service. A vehicle routing problem analysis layer finds the best routes for a fleet of vehicles. | |
Converts an ArcView turn table or ArcInfo Workstation coverage turn table to an ArcGIS turn feature class. | |
Updates the network attribute parameter value for a network analysis layer. The tool should be used to update the value of an attribute parameter for a network analysis layer prior to solving with the Solve tool. This ensures that the solve operation uses the specified value of the attribute parameter to produce appropriate results. Note: | |
Updates all the edge references in turn feature classes using an alternate ID field. This tool should be used after making edits to the input line features that are referenced by the turn features to synchronize the turn features based on the alternate ID fields. | |
Updates all the edge references in the turn feature class using the geometry of the turn features. This tool is useful when the IDs listed for the turn can no longer find the edges participating in the turn due to edits to the underlying edges. | |
Upgrades the schema of the network dataset. Upgrading the network dataset allows the network dataset to make use of the new functionality available in the current software release. Legacy:This is a deprecated tool. To learn more about how this tool works, view the archived documentation. This functionality has been replaced by the Upgrade Dataset tool in the Geodatabase Administration toolset. Upgrade Dataset has the ability to upgrade network datasets as well as other types of datasets, such as parcel fabrics, to the current ArcGIS release. |
Network Analyst classes
Class | Description |
---|---|
Provides access to analysis properties from a closest facility network analysis layer. The GetSolverProperties function is used to obtain a ClosestFacilitySolverProperties object from a closest facility network analysis layer. | |
Provides access to analysis properties from a location-allocation network analysis layer. The GetSolverProperties function is used to obtain a LocationAllocationSolverProperties object from a location-allocation network analysis layer. | |
Provides the ability to map field names or set default values for the properties of a network analysis class within a network analysis layer. The properties of the network analysis class are used as inputs by the solvers while performing the network analyses. | |
Provides a Python dictionary of NAClassFieldMap objects that are used to map field names or set default values for the properties of a network analysis class within a network analysis layer. The dictionary keys are the network analysis class property names, and the values are the NAClassFieldMap objects. | |
Provides access to analysis properties from an origin-destination (OD) cost matrix network analysis layer. The GetSolverProperties function is used to obtain an ODCostMatrixSolverProperties object from an OD cost matrix network analysis layer. | |
Provides access to analysis properties from a route network analysis layer. The GetSolverProperties function is used to obtain a RouteSolverProperties object from a route network analysis layer. | |
Provides access to analysis properties from a service area network analysis layer. The GetSolverProperties function is used to obtain a ServiceAreaSolverProperties object from a service area network analysis layer. | |
Provides read and write access to street directions properties, allowing you to customize the directions output from your network analysis layers. The StreetDirectionsProperties can be read from and set on a SolverProperties object obtained through the GetSolverProperties function. | |
Provides read access to the properties and values of a travel mode. The GetTravelModes function is used to obtain a TravelMode object. |