Publish Routing Services

URL:
https://<catalog-url>/System/PublishingTools/GPServer/Publish Routing Services
Methods:
GET
Version Introduced:
11.0

Description

The Publish Routing Services service is one of the services available in the out-of-the-box PublishingTools geoprocessing service, which is used by an administrator to publish routing services based on a network dataset to an 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 the portal. Once published, the services can be used in client applications such as ArcGIS Pro or Map Viewer Classic on 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 a network dataset and run in ArcGIS Enterprise.

Request parameters

ParameterDetails

networkDataset

(Required)

The network dataset used by the routing services. The workspace containing the network dataset must be registered as a data store item in the ArcGIS Enterprise portal or the stand-alone ArcGIS Server site. The value for this parameter is specified as a JSON that contains datastoreId and path properties. The datastoreId value is the ID of the data store item referencing the workspace of the network dataset. The path value is the relative path to the network dataset in the data store.

For example, if the catalog path of the network dataset in a file geodatabase on the ArcGIS Server machine is C:\data\streets\NorthAmerica.gdb\Routing\Routing_ND and the data store item with ID 3eba512c2a0841d5adcc4c83029d8bf6 is referencing C:\data , the value for this parameter is specified as the following:

Use dark colors for code blocksCopy
1
2
3
4
{
  "datastoreId": "3eba512c2a0841d5adcc4c83029d8bf6",
  "path": "/streets/NorthAmerica.gdb/Routing/Routing_ND"
}

serviceFolder

The name for the server folder that will contain all the routing services created by this service. The service returns an error if the folder contains existing services.

The default value is Routing

solverTypes

The list of Network Analyst solvers to be included in the services. The default is to include all the solvers except SnapToRoads.

Values: ClosestFacility | Location-Allocation | OriginDestinationCostMatrix | Route | ServiceArea | VehicleRoutingProblem | LastMileDelivery | SnapToRoads

The following example shows how to publish routing services only for Route and OriginDestinationCostMatrix solvers:

Use dark colors for code blocksCopy
1
2
3
4
[
  "OriginDestinationCostMatrix",
  "Route"
]

configFile

The file containing additional configuration for the services. If no value is specified, the system default configuration file is used.

To specify a value for this parameter, first upload the configuration file using the upload operation. Then specify the item ID of the uploaded file as the value for this parameter.

For example, if the configuration file is uploaded as item ID i6c15a27e-4f40-44d3-bc27-70809936d04d , the value for this parameter is specified as the following:

Use dark colors for code blocksCopy
1
2
3
{
  "itemID": "i6c15a27e-4f40-44d3-bc27-70809936d04d"
}

f

The response format. The default format is html .

Values: html | json | pjson

Example usage

Example using the required parameters

This example shows how to call the service using only the required parameters. The routing services are published to a server folder named Routing and include services for all the solvers. The system default configuration file for service settings is used.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
POST https://dev0017162.esri.com/server/rest/services/System/PublishingTools/GPServer/Publish%20Routing%20Services/submitJob HTTP/1.1
Content-Type: application/x-www-form-urlencoded

f=json
&token=<ACCESS_TOKEN>
&networkDataset=
{
  "datastoreId": "3eba512c2a0841d5adcc4c83029d8bf6",
  "path": "/streets/NorthAmerica.gdb/Routing/Routing_ND"
}

Example using all parameters

This example shows how to call the service using all the parameters. The routing services are published in a server folder named NorthAmerica and only include services for Route and OriginDestinationCostMatrix solvers. The service uses settings from a custom configuration file.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
POST https://dev0017162.esri.com/server/rest/services/System/PublishingTools/GPServer/Publish%20Routing%20Services/submitJob HTTP/1.1
Content-Type: application/x-www-form-urlencoded

f=json
&token=<ACCESS_TOKEN>
&networkDataset=
{
  "datastoreId": "3eba512c2a0841d5adcc4c83029d8bf6",
  "path": "/streets/NorthAmerica.gdb/Routing/Routing_ND"
}
&serviceFolder=NorthAmerica
&solverTypes=
[
  "OriginDestinationCostMatrix",
  "Route"
]
&configFile=
{
  "itemID": "i6c15a27e-4f40-44d3-bc27-70809936d04d"
}

Errors and warnings

The following are errors and warnings associated with the Publish Routing Services service:

Error codeMessageDescriptionSolution

30055

Network dataset does not support directions.

The directions have not been set up for the network dataset.

Set up the directions for the network dataset and rebuild it.

30206

An unexpected error occurred while running the tool.

Something unexpected caused the tool to fail, and no exception handling is in place to provide a specific error message.

This error is considered a bug. Contact Esri Technical Support to report a bug for your scenario.

30252

The network data source must have at least one time-based travel mode that does not use the Public Transit evaluator.

When publishing the LastMileDelivery solver type as a routing service, the network dataset should have at least one time based travel mode that does not use the Public Transit evaluator.

Create at least one travel mode on the network dataset that does not use the public transit evaluator, or do not choose Last Mile Delivery solver type.

30253

Network has no travel modes.

The selected network has no travel modes and cannot be used for this analysis.

Create at least one travel mode on the network dataset, or use a different network dataset that includes a travel mode.

30258

Only specify a value for the networkDataset parameter or the networkDatasetExtents parameter but not both.

The Publish Routing Services tool only works with a network dataset or the network dataset extents.

Specify a value for either the networkDataset parameter or the networkDatasetExtents parameter, but not both, and rerun the tool.

30259

Invalid value for the "<value>" parameter. The value must be a JSON containing "<value>" properties.

The input JSON value specified for the parameter is invalid.

Specify a JSON value containing the datastoreId and path property values. The datastoreId value is the ID of the data store item referencing the workspace of the network dataset. The path value is the relative path to the network dataset in the data store. For example, if the catalog path of the network dataset in a file geodatabase on the ArcGIS Server machine is C:\data\streets\NorthAmerica.gdb\Routing\Routing_ND and the data store item is referencing C:\data , specify the value for this parameter as {"datastoreId": "3eba512c2a0841d5adcc4c83029d8bf6", "path": "/streets/NorthAmerica.gdb/Routing/Routing_ND"} .

30260

Network dataset "<value>" does not exist within the data store

The network dataset that was specified using the path property does not exist.

Specify the correct relative path to the network dataset in the data store using the path property.

30261

Network dataset extents "<value>" does not exist within the data store.

The network dataset extent feature class that was specified using the path property does not exist.

Specify the correct relative path to the network dataset extent feature class in the data store using the path property.

30262

Failed to get the token.

The Publish Routing Services tool failed to obtain a token from the signed-in user.

Ensure that the PublishingTools system service is secure and does not allow anonymous access.

30263

Failed to get the logged in user.

The Publish Routing Services tool failed to obtain the signed-in user.

Ensure that the signed-in user is a valid user in the ArcGIS Enterprise portal.

30264

Invalid data store id: "<value>".

The data store item specified using datastoreId does not exist.

Specify a valid data store item ID.

30265

Invalid path "<value>" for the network dataset as it does not contain a feature dataset name and a network dataset name

The network dataset that was specified using the path property does not exist.

When referencing a network dataset from an enterprise geodatabase, the path property must include the name of the feature dataset containing the network dataset and the name of the network dataset. For example, if the network dataset named Routing_ND is in a feature dataset named Routing, the path property must be specified as /Routing/Routing_ND .

30266

The network dataset does not have at least one time based cost attribute

The Publish Routing Services tool requires a network dataset that has at least one cost attribute with time-based units.

Use a network dataset with at least one time-based cost attribute or create a time-based cost attribute on the network dataset.

30267

The network dataset does not have at least one distance based cost attribute

The Publish Routing Services tool requires a network dataset that has at least one cost attribute with distance-based units.

Use a network dataset with at least one distance-based cost attribute or create a distance-based cost attribute on the network dataset.

30268

A service area index has not been created on the network dataset.

The input network dataset is missing the service area index.

While it is not required, a service area index improves performance when generating service areas and also improves the appearance of the polygons. It is recommended that you define a service area index on the network dataset.

30269

The network dataset has not been dissolved.

The input network dataset has not been dissolved.

While it is not required, dissolving a network dataset reduces the time it takes to solve analyses, draw results, and generate driving directions. It is recommended that you dissolve the network dataset.

30270

The network dataset is not stored in a geodatabase.

The Publish Routing Services tool only works with network datasets that are stored in a geodatabase.

Specify a network dataset that is stored in a file geodatabase, a mobile map package, or an enterprise geodatabase.

30271

The network dataset does not have a travel mode of type Truck or a cost attribute named TruckTravelTime . The geoprocessing services might return unexpected results when the Impedance parameter is set to "Truck Time".

The input network dataset does not define the TruckTravelTime cost attribute.

The TruckTravelTime cost attribute must be available on the input network dataset for the tools in the NetworkAnalysis and NetworkAnalysisSync geoprocessing services to run as expected. If this cost attribute is missing, the tools use the first cost attribute defined on the network dataset, which may cause unexpected analysis results.

If the network dataset can model the travel time taken by trucks to travel on streets, define the TruckTravelTime cost attribute on the network dataset. Otherwise, do not use the Truck Time option when specifying the Impedance parameter for the tools.

30272

The network dataset does not have a travel mode of type Walk or a cost attribute named WalkTime . The geoprocessing services might return unexpected results when the Impedance parameter is set to "Walk Time ".

The input network dataset does not define the WalkTime cost attribute.

The WalkTime cost attribute must be available on the input network dataset for the tools in the NetworkAnalysis and NetworkAnalysisSync geoprocessing services to run as expected. If this cost attribute is missing, the tools use the first cost attribute defined on the network dataset, which may cause unexpected analysis results.

If the network dataset can model the time taken by pedestrians to walk on streets, define the WalkTime cost attribute on the network dataset. Otherwise, do not use the Walk Time option when specifying the Impedance parameter for the tools.

30273

The following warnings were returned when analyzing the input network dataset:

The input network dataset returned warnings that may result in reduced performance of the routing services.

Modify the network dataset properties or perform additional processing on the network dataset such as creating a service area index or dissolving the network dataset.

30274

The following errors were returned when analyzing the input network dataset:

The input network dataset returned errors that prevented routing services from publishing.

Modify the network dataset properties to fix the errors reported from the analyzer.

30276

Failed to create the network dataset layer.

The Publish Routing Services tool did not create a network dataset layer from the input network dataset.

Ensure that the ArcGIS Server account has been granted at least read-only access to the network dataset.

If you are using a licensed network dataset, ensure that the data license is successfully installed on the ArcGIS Server machine running Windows or Linux.

30277

User "<value>" does not have privileges to publish services

The signed-in user running the Publish Routing Services tool does not have privileges to publish services.

Assign the Administrator or Publisher role to the user running the Publish Routing Services tool. The User role is insufficient.

30278

User "<value>" does not have privileges to publish web tools and server-based layers

The signed-in user running the Publish Routing Services tool does not have privileges to publish web tools and ArcGIS Server web layers.

Assign the correct privilege to the user running the tool to publish web tools and ArcGIS Server web layers.

30279

User "<value>" does not have administrator privilege

The signed-in user running the Publish Routing Services tool does not have privileges to publish geoprocessing services.

When publishing to a stand-alone ArcGIS Server site, the user running the tool must be assigned the Administrator role. If the user is assigned the Publisher role, enabling the Publisher role to publish geoprocessing services is not supported.

30280

Service folder, "<value>", is not empty

The service folder contains one or more services.

Specify a new service folder (not an existing folder), or remove all the services from the specified folder.

30281

Failed to create service folder, "<value>"

The service folder cannot be created because it has one or more invalid characters.

Ensure that the name does not contain any spaces or characters from the following list:

  • " (quotation mark)
  • < (open angle bracket)
  • > (close angle bracket)
  • | (vertical bar)
  • : (colon)
  • * (asterisk)
  • ? (question mark)
  • , (comma)
  • / (forward slash)

30282

Failed to run "<value>" tool

A geoprocessing tool that was expected to publish one of the geoprocessing services failed to run successfully.

Refer to the messages returned from the Publish Routing Services tool to determine the cause of the tool failure. Rerun the tool. If the error persists, contact Esri Technical Support.

30283

Failed to create supporting files required by the network analysis utility geoprocessing service.

An unexpected error was encountered when creating the supporting files required by the network analysis utility geoprocessing service.

This error is considered a bug. Contact Esri Technical Support to report a bug for your scenario.

30284

The network dataset is configured to retrieve live traffic from a portal other than the one to which the service is being published

The source for live traffic configured with the input network dataset is not the same as the ArcGIS Enterprise portal to which the ArcGIS Server site is federated.

Modify the live traffic source for the network dataset to match the ArcGIS Enterprise portal with which the ArcGIS Server site is federated.

30317

The token is valid for <value> minutes and might expire before the tool finishes running. Use a token that is valid for at least <value> minutes.

The token used when publishing the routing service may expire and cause failures.

  • If you are publishing a routing service to a federated ArcGIS Server site, review the value set for the maximum token expiration time in your ArcGIS Enterprise portal and set it to a higher value.
  • If you are publishing a routing service to a stand-alone ArcGIS Server site, edit the lifespan of long-lived tokens.

30320

Invalid authentication info "<value>". The value must be a JSON containing "token" property.

The input JSON value specified for the parameter is invalid.

The value for this parameter is specified as a JSON that must contain the token property and optionally the referer property.

30321

The token has expired. Use a token that is valid for at least <value> minutes.

The token used when publishing the routing service has expired resulting in failures.

For the Publish Routing Services tool to obtain a token that does not expire before the tool finishes running, update the maximum token expiration time in your ArcGIS Enterprise portal to a higher value if publishing to a federated ArcGIS Server site or update the lifespan of long-lived tokens if publishing to a stand-alone ArcGIS Server site and rerun the tool.

30327

Failed to renew the portal token.

The Publish Routing Services tool did not obtain a token that is valid for a longer duration.

Sign out of your ArcGIS Enterprise portal, sign back in, and rerun the Publish Routing Services tool.

30328

The config file is not a valid json file.

The file containing the additional service properties is not a valid JSON file.

Review the contents of the input config file using a JSON validator tool to fix any syntax errors and rerun the Publish Routing Services tool.

30329

The version of the config file is not supported.

The file containing the additional service properties is not supported with the current version of ArcGIS Enterprise.

If you are using the config file from an earlier version of ArcGIS Enterprise, obtain the template config file from the version of ArcGIS Enterprise you are currently using, modify the file with the necessary changes, and rerun the Publish Routing Services tool.

30353

Network has no time zone attribute.

When publishing the LastMileDelivery solver type as a routing service the network dataset should have a time zone attribute.

Create a time zone attribute on your network dataset, or do not choose Last Mile Delivery solver type.

30358

Network has no travel modes with a time based impedance attribute and a distance attribute.

When publishing the LastMileDelivery solver type as a routing service, the network dataset should have at least one travel mode with a time based impedance attribute and a distance attribute.

Create at least one travel mode on the network dataset that uses a time based impedance attribute, or do not choose Last Mile Delivery solver type.

30378

The network dataset is not stored in a mobile geodatabase.

When publishing the SnapToRoads solver type as a routing service the network dataset should be stored in a mobile geodatabase.

Export your network dataset to be stored in a mobile geodatabse using Create Mobile Map Package geoprocessing tool, or do not choose SnapToRoads solver type.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.