Programming with Network Analyst


Summary This topic discusses the best approach to perform some specific network analysis tasks.

In this topic


Determining your goals

Network Analyst can be used in ArcMap through geoprocessing tools, via ArcGIS Server or via ArcObjects. Before you begin programming with Network Analyst, determine what your goals are and decide where in the suite of Network Analyst products you can best accomplish your goals. Review this topic to help determine how to approach these specific tasks.

Automating Network Analyst workflows

See the following references for more information on automating Network Analyst workflows:
  • Geoprocessing Automate your workflow by utilizing the Network Analyst Geoprocessing tools
  • Server—For information to develop with each of the server application programming interfaces (APIs), see the following section on Using Network Analyst in ArcGIS Server. For information on Network Analyst Server ArcObjects, see the following:
    • esriNetworkAnalyst—The Server portion of the NetworkAnalyst library to access the public API for the ArcGIS Server API for Network Analyst.
  • ArcObjects—For information about programming against the Network Analyst API and specific components, see NetworkAnalyst library overview. For Network Analyst ArcObjects information, see the following:
    • esriNetworkAnalyst—See the previously mentioned Network Analyst library overview to access the public API for Network Analyst solvers, NAClasses, NALayers, street directions agents, locators, and so on. The ArcGIS Server API for Network Analyst is also located in this library.
    • esriNetworkAnalystUI—See the NetworkAnalystUI library overview to understand how to access the Network Analyst user interface (UI) in ArcMap.
    • esriGeodatabase—See the Geodatabase library overview to find out how to programmatically access the network dataset.
    • esriNetworkAnalysis—This library is not used by Network Analyst. It contains components to use with the geometric networks used in utility and natural resource networks.

Performing network analysis

See the following for information on finding the shortest path route or closest facility, calculating a service area or origin destination cost matrix, optimizing the routing of a fleet of vehicles, or finding the best location for a facility:
  • ArcMap—To accomplish these tasks use the Network Analyst solvers Route, Closest Facility, Service Area, Origin-Destination Cost Matrix, Vehicle Routing Problem (VRP) Solver, or Location-Allocation Solver to analyze a street network with ArcMap.  See the document Types of network analyses to explore conceptual information about each solver.
  • Geoprocessing—To automated your work, use the Geoprocessing tools applicable to each of the solvers. 
  • ArcObjects—You can also program against the previously mentioned Network Analyst library overview within ArcObjects to create a stand-alone application.

Extending the ArcMap user interface

See the following information about working with the Network Analyst user interface: 
  • ArcObjects—To programmatically access components, such as, the NAWindow and the Network Analyst extension, see the previously mentioned Network Analyst UI library overview, which contains helpful information, as well as code snippets.
  • Adding buttons to the NAWindow Context menu—See Sample: Export any network analysis class to a text file to add a button to the right-click context menu for a class in the NAWindow.

Writing a new solver into the Network Analyst framework

If a network solver is required that is not supported see the following information:
  • ArcObjects—Use C++ to create a solver. The large number of calls to the network dataset via the .NET interop can generate a significant performance hit. The Connectivity Solver sample, in the C++ software development kit (SDK), is a good resource to write your solver. For code concerning the use of the network dataset API in writing your solver algorithm, see How to programmatically traverse a street network. For information about programming against the Network Analyst API, see the Network Analyst library overview.

Working with network datasets

See the following information about working with street networks in ArcGIS:
  • General conceptsNetwork Analyst works on street networks in the form of network datasets. To get started, see What is Network Analyst?.  For more information, see the help section about network datasets.
  • ArcObjects—To program against network datasets, see the network dataset section in the network dataset section of the Geodatabase library overview, which has links to other topics and code samples.
  • Creating a network datasetUse ArcMap to create a network dataset, which has a network dataset creation wizard to help step you through the process. To programmatically create a network dataset, see the previously mentioned Geodatabase library overview, which includes links to network dataset samples and topics about programmatically creating a network dataset.
  • Opening a network dataset—See How to open a network dataset.

Working with geometric networks

See the following information about working with utility and natural resource networks in ArcGIS:
  • General conceptsNetwork Analyst does not work with the directed flow networks necessary to model utility and natural resource networks. See the section on geometric networks in the previously mentioned Geodatabase library overview.

Determine the proximity from one location to another

See the following information about proximity:
  • Geoprocessing—Network Analyst can help you find the network distance between locations. For non-network spatial distances, straight line (Euclidian) distance between two points can be determined by using the Point Distance Geoprocessing tool. Straight line closest facility analysis can be done using the Near Geoprocessing tool. A buffer polygon, instead of network service areas, can be determined using the Buffer and Multiple Ring Buffer tools. A cost table, instead of the origin-destination cost matrix, can be calculated with the Generate Near Table tool.

    See the following table with links to specific geoprocessing tools:
 
Proximity task
Network distances
Straight line distances
Point-to-Point proximity
Find the nearest location from a set of locations
Find the distance out from a location
Find the distances from every location in a set of locations to every location in another set of locations

Working with street directions

After a network analysis is performed, a list of directions can be generated. See the following information about working with directions:

Extending the network dataset through custom evaluators

An evaluator assigns value for network attributes. See the following information about working with network evaluators:

Loading data into a Network Analysis Layer

See the following information about loading data into network analysis scenarios:

Working with the results of a completed analysis

See the following information about working with network analysis layers after a solve has been completed:
  • General concepts— To understand the resulting output classes after a solve, see the above listed conceptual help sections for each solver.
  • ArcObjects :

Using Network Analyst in ArcGIS Server

See the following information about working with Network Analyst in Server:
  • Publishing a network analysis service—See the ArcGIS Server SDK for help learning about network analysis services, including a tutorial on publishing the service.
  • Performing network analysis in ArcGIS Server Help for developing with each of the server APIs is located in the Web APIs section of the ArcGIS Server online Resource Center. The APIs that Network Analyst supports are as follows:


See Also:

What is Network Analyst?
About the Network Analyst Tutorial
Essential Network Analyst vocabulary
NetworkAnalyst
Network Analyst Object Model Diagram
NetworkAnalystUI
An overview of the Network Analyst toolbox
What is a network dataset?
What are geometric networks?