The Publish Routing Services utility allows you to publish directions, routing, and logistics services based on a network dataset to your ArcGIS Server. These services can be used to perform route, closest facility, service area, location-allocation, origin destination cost matrix, or vehicle routing problem analyses on transportation networks. If your ArcGIS Server is federated with a portal, the services are configured as utility services with your portal. Once published, the services can be used with ArcGIS Desktop applications such as ArcGIS Pro and ArcMap, or in the Map Viewer application available with ArcGIS Enterprise portal to get directions and perform analysis. The services are similar to directions and routing services available with ArcGIS Online, but are based on your own network dataset and running in your ArcGIS Enterprise.
License:
To use this utility, your ArcGIS Server site needs to have an ArcGIS Network Analyst extension license.
Data requirements
You can use this utility with a network dataset that is available as part of StreetMap Premium for ArcGIS or with your own network dataset. Before running the utility, the network dataset should be copied (in the same directory path) to all the machines participating in your GIS Server site.
Tip:
While you can keep the network dataset in a shared location that is accessible to all of the machines in your GIS Server site, it is recommended to copy the network dataset locally on each machine for best performance when running the services.
If your StreetMap Premium data is licensed, you need to install the appropriate data license on each machine before running this utility. Follow the instructions for installing the data license on Linux or Windows.
The utility supports network datasets from StreetMap Premium for ArcGIS 2015 Release 1 or later.
Legacy:
Older versions of Streetmap Premium network datasets (including the network datasets in SDC format) are not supported.
If you are using your own network dataset, it must satisfy the following conditions:
- Has at least one time-based and one distance-based cost attribute
- Defines at least one travel mode
- Stored in a file geodatabase
- Supports directions
Parameters
Once you have correctly set up the network dataset on your GIS Server site, you can run the Publish Routing Services utility using the following parameters.
Parameter | Details |
---|---|
-u | User name for a user with publisher or administrative privileges in the ArcGIS Server site. If the site is federated with a portal, the user must be a portal user and can have administrative privilege or a publisher privilege that allows publishing web tools and publishing server-based layers. If the site is not federated, the user must have administrative privileges. If your site is configured with web-tier authentication, specify a built-in user, such as the primary site administrator account or the initial administrator account in your portal. |
-p | The password of the user who was specified with the -u parameter. |
-s | The fully qualified domain name of the machine running ArcGIS Server, such as gisserver.domain.com, or the local URL to your ArcGIS Server site in the format https://gisserver.domain.com:6443/arcgis. |
-P | The fully qualified domain name of the machine, such as gisportal.domain.com, where Portal, to which your ArcGIS Server site federates with, is installed. The value can also be a local URL to the portal in the format https://gisportal.domain.com:7443/arcgis A value for this option is required only if the ArcGIS Server that will host the routing services is federated with the portal. |
-n | The full path to the network dataset. Along with the path to the file geodatabase, the path should also include the name of the network dataset and the name of the feature dataset containing the network dataset. For example, a value for this option can be c:\data\Streets.gdb\Routing\Routing_ND on Windows and /data/Streets.gdb/Routing/Routing_ND on Linux where Streets.gdb is the file geodatabase that has a network dataset named Routing_ND in a feature dataset named Routing. |
-o | Path to a folder where the utility will create the service definition files for the services and a log file named publishroutingservices.log that includes the details about the execution as well as any errors that might be encountered. |
-f | The folder name used to create all the routing services on the ArcGIS Server site. The default value is Routing. |
-e | The full path to the extents feature class containing the extents for multiple network datasets. This option should be specified only if you are publishing services that need to use more than one network datasets. Additional details on how to setup routing services using this option can be obtained by contacting Esri Professional Services. |
-h | Prints help for the utility. |
Examples
The following examples show how to call the Publish Routing Services utility on an ArcGIS Server site that is federated with a portal.
Publish routing services on ArcGIS Server (Windows).
C:\Python27\ArcGISx6410.6\python.exe "C:\Program Files\ArcGIS\Server\tools\PublishRoutingServices\publishroutingservices.py" -s gisserver.domain.com -P gisportal.domain.com -u admin -p site.admin -o D:\RoutingServices\ServiceDefinitions -n D:\data\Streets.gdb\Routing\Routing_ND
Publish routing services on ArcGIS Server (Linux). The example assumes that the ArcGIS Server installation location is /arcgis/server.
Note:
Unlike on Windows, you do not have to specify the Python installation location when running the utility on Linux.
/arcgis/server/tools/publishroutingservices/publishroutingservices -s gisserver.domain.com -P gisportal.domain.com -o /data/routing-services/service-definitions -n /data/Streets.gdb/Routing/Routing_ND
You can call the utility by passing the parameters from a file. This is useful if you are running the utility as part of an automated process or you do not want to type all the options at the command line. In order to specify the parameters from a file, create a text file and then specify each option on a new line. The parameter name and value should be separated using an = sign. A sample file with various options is shown below.
-u=admin
-p=secret
-s=gisserver.domain.com
-P=gisportal.domain.com
-o=D:\RoutingServices\ServiceDefinitions
-n=D:\data\Streets.gdb\Routing\Routing_ND
To call the tool with the above tool-params.txt file, call the tool and specify the path to the file with @ symbol.
Caution:
Make sure your file with parameters does not have any extra new lines or white spaces.
C:\Python27\ArcGISx6410.6\python.exe "C:\Program Files\ArcGIS\Server\tools\PublishRoutingServices\publishroutingservices.py" @D:\RoutingServices\tool-params.txt