Geoprocessing functions in arcpy.na

The Network Analyst module, arcpy.na, includes functions that represent geoprocessing tools from the Network Analyst toolbox. When writing Python code, you can use these geoprocessing tools as Python functions. The following table summarizes the geoprocessing tools that are available in arcpy.na:

Network Analyst geoprocessing functions

Function or toolDescription

AddFieldToAnalysisLayer

Adds a field to a sublayer of a network analysis layer.

AddLocations

Adds input features or records to a network analysis layer. The inputs are added to specific sublayers such as stops and barriers. When the network analysis layer references a network dataset as its network data source, the tool calculates the network locations of the inputs, unless precalculated network location fields are mapped from the inputs.

BuildNetwork

Reconstructs the network connectivity and attribute information of a network dataset. The network dataset must be rebuilt after edits are made 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.

CalculateLocations

Locates input features on a network and adds fields to the input features that describe the network locations. The tool is used to precalculate the network locations of inputs that will be used in a Network Analyst workflow, improving performance of the analysis at solve time. The tool stores the calculated network locations of the inputs in fields in the input data.

CopyTraversedSourceFeatures

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.

CreateNetworkDataset

Creates a network dataset in an existing feature dataset. The network dataset can be used to perform network analysis on the data in the feature dataset.

CreateNetworkDatasetFromTemplate

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.

CreateTemplateFromNetworkDataset

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.

CreateTurnFeatureClass

Creates a new turn feature class to store turn features that model turning movements in a network dataset.

Directions

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 style sheet, the directions can be written to any other file format.

DissolveNetwork

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.

IncreaseMaximumEdges

Increases the maximum number of edges per turn in a turn feature class.

MakeClosestFacilityAnalysisLayer

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 a service hosted online or in a portal.

MakeClosestFacilityLayer

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:

MakeLocationAllocationAnalysisLayer

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 so 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 a service hosted online or in a portal.

MakeLocationAllocationLayer

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:

MakeNetworkDatasetLayer

Creates a network dataset layer from a network dataset.

MakeODCostMatrixAnalysisLayer

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.

MakeODCostMatrixLayer

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:

MakeRouteAnalysisLayer

Makes a route network analysis layer and sets its analysis properties. A route network 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 a routing service hosted online or in a portal.

MakeRouteLayer

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:

MakeServiceAreaAnalysisLayer

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 a routing service hosted online or in a portal.

MakeServiceAreaLayer

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:

PopulateAlternateIDFields

Creates and populates additional fields on the turn feature classes that reference the edges in the network by alternate IDs. The alternate IDs help maintain the integrity of the turn features if the edge sources are edited in such a way that their ObjectID values change.

ShareAsRouteLayers

Shares the results of network analyses as route layer items in a portal. A route layer includes all the information for a route such as the stops assigned to the route or the orders serviced by a route, as well as the travel directions.

Solve

Solves the network analysis layer problem based on its network locations and properties.

SolveVehicleRoutingProblem

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 VRP analysis layer finds the best routes for a fleet of vehicles.

TurnTableToTurnFeatureClass

Converts an ArcView turn table or ArcInfo Workstation coverage turn table to an ArcGIS turn feature class.

UpdateAnalysisLayerAttributeParameter

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:

UpdateByAlternateIDFields

Updates all the edge references in turn feature classes using an alternate ID field to identify the corresponding edge features for each turn. Use this tool after making edits to the edge source feature classes that alter ObjectID values.

UpdateByGeometry

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.