The Publish Routing Services utility allows you to publish directions, routing, and logistics services based on a network dataset to your ArcGIS Server site. 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 the ArcGIS Server site is federated with a portal, the services are configured as utility services with your portal. Once published, the services can be used in client applications such as ArcGIS Pro or the Map Viewer Classic of the 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 run in ArcGIS Enterprise.
License:
To use this utility, your ArcGIS Server site must have an ArcGIS Network Analyst extension license.
Tip:
The services created by this utility have been significantly improved at ArcGIS Server 10.8. If you are upgrading your existing ArcGIS Server site from previous versions, it is recommended that you delete any existing routing services created by this tool in the previous version of your server site and republish the routing services using the latest version of the tool.
Data requirements
You can use this utility with a network dataset that is available as part of ArcGIS StreetMap Premium, or with your own network dataset stored in a file geodatabase, enterprise geodatabase, or a mobile map package. Before running the utility, the network dataset should be copied (in the same directory path) to all the machines participating in your ArcGIS Server site. If your network dataset is stored in an enterprise geodatabase, the enterprise geodatabase must be accessible to all the machines in your server site.
Tip:
While you can keep the file geodatabase-based or mobile map package-based network datasets in a shared location that is accessible to all of the machines in your server site, it is recommended that you copy the network dataset locally on each machine for best performance when running the services.
If your ArcGIS 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 Windows.
The utility supports network datasets from ArcGIS StreetMap Premium 2015 Release 1 or later.
Legacy:
Earlier versions of ArcGIS 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
- Supports directions
If you are using a network dataset from a mobile map package such as StreetMap Premium for ArcGIS mobile map packages, you should first run the Extract Package geoprocessing tool to extract the contents of the mobile map package to a local folder before running the Publish Routing Services utility.
Parameters
Once you have correctly set up the network dataset on your ArcGIS Server site, you can run the Publish Routing Services utility using the following parameters:
Parameter | Details |
---|---|
-u | Username 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 is 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 site that will host the routing services is federated with the portal. |
-n | The full path to the network dataset. If the network dataset is in a file geodatabase, the value for the -n option should include the path to the file geodatabase, 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. If the network dataset is in a mobile map package, the value for the -n option should include the path to the SQLite database from the folder where the mobile map package was extracted, 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:\street_data\p14\northamerica.geodatabase\Routing\Routing_ND on Windows and /data/street_data/p14/northamerica.geodatabase/Routing/Routing_ND on Linux where northamerica.geodatabase is the SQLite geodatabase that has a network dataset named Routing_ND in a feature dataset named Routing. If the network dataset is in an enterprise geodatabase, the value for the -n option should include the path to the database connection file, 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:\street_data\egdb.sde\Routing\Routing_ND on Windows and /street_data/egdb.sde/Routing/Routing_ND on Linux where egdb.sde is the connection file for the enterprise geodatabase that has a network dataset 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 operation 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 dataset. Additional details on how to set up routing services using this option can be obtained by contacting Esri Professional Services. |
-S | The list of solvers to be included in the services. The valid choices are Route, ClosestFacility, ServiceArea, OriginDestinationCostMatrix, Location-Allocation, VehicleRoutingProblem, LastMileDelivery, and SnapToRoads. The value for this option is specified as a comma-separated list of valid choices. The choice values are case sensitive. The default value is to create services for all the solvers except SnapToRoads . |
-c | The full path including the name of the file containing additional configuration for the services. You can use this configuration file to specify certain properties for the routing services such as the minimum and maximum number of service instances. The framework/runtime/ArcGIS/Resources/ArcToolBox/Services/routingservices folder within theArcGIS Server installation directory includes two sample configuration files, publishroutingservices.json and publishroutingservices_dedicated.json, that show all the supported settings. The tool uses the publishroutingservices.json file by default. |
-d | Specifying this option creates a dedicated service for every solver. This is an advanced option. When this option is specified, your ArcGIS Server site will use a lot more compute and memory resources. This option is recommended only for specialized ArcGIS Server sites. When this option is used, the -c option should specify a configuration file that is similar to the publishroutingservices_dedicated.json file. |
-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.
Caution:
If the value for any of the parameters supported by the utility uses the @ character, you cannot specify the parameter values on the command line. Instead, you should save the parameters in a file and pass the parameters from the file.
Publish routing services on ArcGIS Server. The example assumes that the ArcGIS Server installation location is C:\Program Files\ArcGIS\Server.
"C:\Program Files\ArcGIS\Server\tools\PublishRoutingServices\publishroutingservices.bat" -s gisserver.domain.com -P gisportal.domain.com -u admin -p secret -o D:\RoutingServices\ServiceDefinitions -n D:\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. To specify the parameters from a file, create a text file and specify each option on a new line. The parameter name and value should be separated using the = 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 the @ symbol.
Caution:
Make sure your file with parameters does not have any extra new lines or white spaces.
"C:\Program Files\ArcGIS\Server\tools\PublishRoutingServices\publishroutingservices.bat" @D:\RoutingServices\tool-params.txt