Tutorial: Publishing a network analysis service

Complexity: Beginner Data Requirement: ArcGIS Tutorial Data Setup

ArcGIS Server supports performing network analysis on transportation networks. This includes finding the best route, finding the closest facilities to an incident, or generating service areas for one or more facilities. To learn more about the different types of network analysis and their capabilities, see Types of network analyses in the ArcGIS Desktop Help.

This tutorial walks you through the process of creating a map document capable of being used for network analysis and publishing it as an ArcGIS Server network analysis service. It then refers you to help on how to consume the network analysis service. The data for this tutorial is installed with the software development kit (SDK). If you don't have the SDK installed, you can use the Network Analyst ArcTutor data or try to work through the steps using your own data instead.

Creating the map document

A network analysis service requires a map service that contains one or more network analysis layers. This means the map document published to ArcGIS Server must contain one or more layers that are network analysis layers created with tools from the Network Analyst toolbar. Currently the network analysis service supports the route, closest facility, and service area analysis layers.

Follow these steps to create a single map document capable of performing all three of these types of network analysis:

Steps:
  1. Start ArcMap and open a new empty map document.
  2. Click Customize > Extensions and check Network Analyst to ensure the Network Analyst extension is enabled.
  3. Click Customize > Toolbars > Network Analyst to make the Network Analyst toolbar visible.
  4. Add a network dataset, which is required to be in the map to create a network analysis layer. Click File > Add Data > Add Data, browse to a network dataset, then add it to the map. For this example, use the network dataset %ARCGISHOME%\DeveloperKit10.0\Samples\data\SanFrancisco\SanFrancisco.gdb\Transportation\Streets_ND. (If you are using ArcTutor data, browse to the SanFrancisco geodatabase, which is typically installed at C:\arcgis\ArcTutor\NetworkAnalyst\Tutorial\SanFrancisco.gdb.) When prompted to add all feature classes that participate in Streets_ND to the map, click Yes.

    You can also improve the look of the map by adding other feature classes, such as Shoreline (in the BaseMap feature dataset), and by setting a background color for the data frame to represent the water.

  5. In the table of contents, uncheck the Streets_ND_Junctions layer since most users do not care to see it. Also uncheck the network dataset layer (Streets_ND) since drawing the streets feature layer is faster and more flexible than drawing the network dataset layer. Symbolize the streets using a unique value renderer based on the field SPEEDCAT.
    Symbology of Streets
  6. Add one or more network analysis layers to your map: click the Network Analyst drop-down menu on the Network Analyst toolbar and choose the type of network analysis layer you want to create. For example, click New Route to create a route analysis layer.
    Network Analyst toolbar
  7. Change the symbology of the network analysis sublayers if you want different symbology. For example, you might want to make the Routes feature layer 50 percent transparent and have lines that are six pixels wide.
    Overview of resulting map document
  8. Click File > Save to save the map document to disk.

    The name and location of the map document can be anything. However, if you have the SDK and want all the developer samples to work with this service without any modification, save it to the location of the sample map document that comes with the software developer kit. To do this, follow these substeps:

    1. Change the name of %ARCGISHOME%\DeveloperKit10.0\Samples\data\SanFrancisco\SanFrancisco.mxd to orig-SanFrancisco.mxd.
    2. Save your map document as %ARCGISHOME%\DeveloperKit10.0\Samples\data\SanFrancisco\SanFrancisco.mxd.

Publishing the service

Once you have a map document with a network analysis layer, you're ready to publish it as a network analysis service. You'll publish the map document as a service and enable the network analysis capability, which will create a network analysis service of the same name.

TipTip:

Before publishing your services, be sure to read and follow the guidelines presented in Preparing resources for publishing as services. These will help you ensure that the server has permissions to read and access all the data for your model and your map. Specifically, the ArcGIS Server Object Container (SOC) account needs to have read permissions to the directories in which the map document, the network dataset, and any additional data referenced by the map document are stored. The SOC account also needs read and write access to the server output directory. If you're using the default server output directory installed with ArcGIS Server (C:\arcgisserver\arcgisoutput), the installation process already applied the appropriate permissions for you.

Follow these steps to publish the services via ArcGIS Server Manager:

Steps:
  1. Log in to ArcGIS Server Manager and click Publish a map, globe, or other GIS resource as a service.
    Dive-inDive-in:

    There are two wizards in Manager that you can use to publish services. This link takes you to the Publish GIS Resource wizard, which is the simplest way to create a service. It asks you the minimum amount of information needed to create a service.

    The other way to create services is the Add New Service wizard. This wizard is the completely manual way of publishing a service; it prompts you for all the service parameters.

  2. On the first page of the wizard, you're prompted for the resource that you want to publish. This is the map document with the network analysis layers. If it's in a shared directory, you can browse to the map document. If it's not in a shared location, carefully type the path of the map document. For example: C:\Program Files\ArcGIS\DeveloperKit10.0\Samples\data\SanFrancisco\SanFrancisco.mxd.
  3. Give your service the name SanFrancisco. This name will be used for both the map service and the network analysis service.
    First page of the wizard
  4. On the second page of the wizard, notice that two capabilities are enabled by default. Mapping is enabled for all map services. Network Analysis is enabled because Manager detected that the map you're publishing has one or more network analysis layers. Publishing a map service with the Network Analysis capability enabled creates an associated network analysis service with the same name. Leave these capabilities checked and click Next to move to the final wizard page, which explains that two services will be created and gives their URLs.
    Second page of the wizard
  5. Click Finish to publish the services and close the wizard.
  6. After the service has been published, click Services > Manage Services to see the newly created service. The name is SanFrancisco, and the capabilities for this service include Mapping and Network Analysis.
    Manage Services page

Consuming the network analysis service

The Find Route dialog box in ArcMap allows out-of-the-box configuration to use your network analysis services (described in the next set of steps below). You can also use the Route dialog box in ArcGIS Explorer to access the network analysis service after creating an application configuration that points to the service. In Web applications and other desktop applications, network analysis services must be consumed programmatically. See the Network Analysis Services topic, specifically the section Using the service, for a list of links to code examples for various platforms and application types.

If you're just experimenting with the service and it doesn't matter to you which API you use, the ArcGIS JavaScript API route samples are a simple way to get started. The sample code can be pasted into Notepad and run from your machine as long as you have an Internet connection. You'll just need to replace the sample URL with the URL to your own network analysis service.

Consuming a routing service through the Find Route dialog box in ArcMap

Steps:
  1. Start ArcMap and open a new empty map document.

    You should add one or more layers to the map to provide a visual reference to make it easier to create stops and barriers in the proper locations and to interpret results. If you are using the San Francisco sample data, the Streets feature class in the Transportation feature dataset functions as a good reference layer.

  2. Click the Find Route button Find Route.

    The Find Route dialog box appears.

  3. Click the Options tab.
  4. Use the Routing Service browse button to connect to the network analysis service.
  5. Use the other controls and parameters of the Find Route dialog box to provide inputs to the network analysis. Click Find Route when you are ready to solve the analysis.

Related Topics


3/6/2013