Publish a map service in ArcGIS Pro with the network analysis capability

Routing services allow you to perform network analysis over the web. One of the ways to create a routing service is to publish a map service in ArcGIS Pro with the network analysis capability enabled using the Network Analyst extension.

Learn more about the options for publishing routing services

The first step in creating this type of routing service is to create a map in ArcGIS Pro that contains one or more network analysis layers. Then, publish the map as a service, ensuring that the network analysis capability is enabled. You can consume the resulting service programmatically using ArcGIS web APIs, ArcGIS Runtime SDK, or the REST API of the service in a programming language of your choice.

Create a map

Before you can publish a routing service, you need to create a map in ArcGIS Pro that, at a minimum, contains the network analysis layer you will use in your service. You can either add an existing network analysis layer using the Add Data dialog box or create a network analysis layer. This network analysis layer, either imported or created, should use a local network dataset. If it is using a network data source from a portal (either ArcGIS Online or ArcGIS Enterprise), you cannot publish the map as a service with network analysis capability.

Caution:

Publishing and consuming Location-allocation and Vehicle Routing Problem operations are unavailable via map service with network analysis capability. Therefore you should not add Location-allocation and Vehicle Routing Problem layers to your map.

You can edit the properties of the network analysis layers, such as the number of facilities to find in a Closest Facility Analysis Layer or the travel mode to be used as the default for the analysis, in ArcGIS Pro. These properties are used as default values by the published service.

Learn more about network analysis layers

Publish the service

After you have created and saved the map, you can share the map and its layers as a web layer and enable network analysis capability by following the steps below:

  1. On the Share tab, in the Share As group, click Publish Web Layer to open the Share As Web Layer pane.
  2. Complete all the information on the General tab.
  3. Check the Map Image check box under Layer Type.

    Learn more about sharing a map image layer

  4. On the Configuration tab, configure the map image layer properties and enable network analysis capability.
  5. Click the Analyze button at the bottom of the page to analyze any potential errors or warnings.

    Learn more about analyzing resources

  6. Once the validation is successful, click Publish to share your map.

Configure additional service properties

When you publish a map service with the network analysis capability in ArcGIS Pro, you cannot set all the properties for the service. To set these properties, log in to ArcGIS Server Manager and set the properties by selecting Network Analysis on the Capabilities tab for the service.

The following sections describe the capabilities that can be set for the service in ArcGIS Server Manager.

General

  • Output Directory—The location where the result layers are written.

  • Default Output Geometry Precision—This value sets the default precision of the output geometry after generalization. If it is set to zero or not specified, no generalization of output geometry is performed. If it is specified and positive, it represents the MaximumAllowableOffset parameter.

  • Allow users to save result layers on the server—This box specifies whether users can save result layers on the server for future use.

  • Save result layer on server when an error occurs—This box specifies whether result layers are automatically saved in the output directory if there is an error during analysis. If selected, this option may aid in troubleshooting an error.

  • Save result layer on server when debugging—When this box is selected, result layers are automatically saved in the output directory for every request if the log level is set to DEBUG.

  • Ignore network location fields—If this setting is selected, the service will not use the location fields on the input analysis locations (stops, barriers, facilities, incidents, and so on) if they are passed in with the request. It is useful to ignore network location fields if street names change often to avoid passing in requests with stale location fields.

  • Use portal travel modes—If this setting is selected, the service will use the travel modes configured in your ArcGIS Enterprise portal instead of the travel modes defined on the network dataset used by the service.

  • Licensed for automatic rerouting—If this setting is selected, client applications, such as those built using the Navigation API in ArcGIS Runtime SDK, are notified that the service can be used for rerouting.

    Caution:

    Before checking this setting, make sure that the network dataset used by the service has been licensed for rerouting capabilities. If you are using the network datasets from ArcGIS StreetMap Premium, these datasets are not licensed for automatic rerouting, and checking this property will violate your license agreement for ArcGIS StreetMap Premium. However, if your network dataset is created from street data managed by your organization, you can set this property.

Constraints

Constraints are a set of properties that can be defined for each solver to set parameters for your service output. These properties can be set on the Constraints tab. The following constraints are available for each solver:

  • Max Barriers—The maximum number of point barriers allowed to pass in per request.
  • Max Features intersecting line barriers—The maximum number of streets that can be restricted by line barriers per request.
  • Max Features intersecting polygon barriers—The maximum number of streets that can be restricted by polygon barriers per request.
  • Force Hierarchy Beyond (Extent of Inputs) and Units of Force Hierarchy Beyond (Extent of Inputs)—When stops are a great distance apart, solving requests can require a lot of time and server resources if these options are not selected.

Each solver has the following additional constraints that can be set:

  • Route
    • Max Stops—The maximum number of stops that the user is allowed to pass in per request.
    • Allow time windows—This option specifies whether the service supports the user passing in time windows on the input stops.
  • Service Area
    • Max Facilities—The maximum number of facilities allowed to pass in per request.
    • Max Break and Units of Max Break—The maximum break value that can be specified for a service area request. The impedance units can be based on the following:
      • Time
      • Length
      • Other
    • Force Hierarchy Beyond (Break) and Units of Force Hierarchy Beyond Break—The maximum break value that can be specified for a service area request. After this maximum, the server automatically changes the request to use the network hierarchy.
  • Closest Facility
    • Max Facilities—The maximum number of facilities allowed to pass in per request.
    • Max Facilities to find—The maximum number of facilities from an incident you want the service to find per request.
    • Max Incidents–The maximum number of incidents allowed to pass in per request.
  • OD Cost Matrix
    • Max Destinations—The maximum number of destinations allowed to pass in per request.
    • Max Destinations to Find—The maximum number of destinations from an origin you want the service to find per request.
    • Max Origins—The maximum number of origins allowed to pass in per request.

Use the service

You can use the routing service to provide specialized or locally hosted routing in your web apps and other desktop scenarios programmatically. ArcGIS developers have many platform choices that work with network analysis services, such as ArcGIS web APIs, ArcGIS Runtime SDK, and ArcGIS REST API.

Learn more about the various APIs to access routing services