Publish routing services

You can publish routing services to ArcGIS Enterprise on Kubernetes based on a network dataset that models your street data. Once published, the routing services can be used with various applications, such as ArcGIS Pro, or to get directions and perform analysis in Map Viewer Classic. You can also write applications using ArcGIS web APIs and Runtime SDKs that use these routing services.

To publish routing services, you need to run the Publish Routing Services web tool that is part of the PublishingTools geoprocessing service in ArcGIS Enterprise on Kubernetes. The tool creates all the routing services based on your network dataset and registers them as utility services in your enterprise portal for various applications to discover and use these routing services.

Before running the web tool, ensure that the network dataset used to publish routing services is accessible to all the nodes in the deployment. You can do this by storing the file geodatabase or the mobile geodatabase containing the network dataset in a folder that is registered as folder data store for your deployment or by adding a database data store item for the enterprise geodatabase that stores the network dataset. You also need to obtain a token for a user with administrative privileges that is valid for 60 minutes or more.

Example workflow

This section describes how to publish routing services using a network dataset in a file geodatabase. The steps reference certain data paths and URLs that will be different when you publish routing services directly. Replace the data paths and URLs shown based on your deployment.

The steps reference an ArcGIS Enterprise on Kubernetes deployment running on https://dev0017162.esri.com/arcgis. The routing services are published from a network dataset called Routing_ND, which is contained in a feature dataset called Routing in a file geodatabase called NorthAmerica.gdb.

  1. Sign in to the Services Directory for the deployment (for example, https://dev0017162.esri.com/arcgis/rest/services) using the credentials of the primary administrator account.
  2. Browse to Publishing Routing Services endpoint of the PublishingTools geoprocessing service in the System folder (for example, https://dev0017162.esri.com/arcgis/rest/services/System/PublishingTools/GPServer/Publish%20Routing%20Services).
  3. Click the Submit Job link at the bottom of the page.
  4. In the Submit Job web form, do the following:
    1. For the networkDataset parameter, specify the value 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 and is created when you configured the shared folders while creating the ArcGIS Enterprise organization. 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 file share is /net/data/NorthAmerica.gdb/Routing/Routing_ND and the data store item with ID 3eba512c2a0841d5adcc4c83029d8bf6 is referencing /net/data, the value for the parameter would be specified as follows:
      {
          "datastoreId": "3eba512c2a0841d5adcc4c83029d8bf6",
          "path": "/NorthAmerica.gdb/Routing/Routing_ND"
      }
    2. Do not specify a value for the networkDatasetExtents parameter.
    3. For the serviceFolder parameter, specify a name for a server folder that will contain all the routing services created by this tool.
    4. For the solverTypes parameter, choose the default value, as that specifies that the tool will create routing services for all the Network Analyst solvers.
    5. Do not specify a value for the configFile parameter.
    6. For the authenticationInfo parameter, specify the authentication information, such as the token to use for publishing the services. Specify the value for this parameter as a JSON containing the "token" property and, optionally, a "referer" property that contains the referer value that was specified when generating the token.
      Caution:

      If a value for the authenticationInfo parameter is not specified, the tool uses the token of the user that signed in to the Services Directory. In most cases, this token will expire before the tool completes execution and results in a tool failure.

      To obtain a token, call the Generate Token operation from your enterprise portal. Browse to the generate token endpoint for your enterprise portal (for example, https://dev0017162.esri.com/arcgis/sharing/rest/generateToken) and generate a token that is valid for one day by specifying the following values in the Generate Token web form:

      • Username—The user name of the primary administrator.
      • Password—The password for the primary administrator user.
      • Client—Select the Webapp URL option and specify the URL to your enterprise portal (for example, https://dev0017162.esri.com/arcgis).
      • Expiration1 day.
      • FormatJSON

      Click the Generate Token button. This will generate a JSON which will look similar to

      Output from Generate Token

      {
        "token": "Ci4vgz18Vto2bK7mXVXLOE3XREXmt4sUI-QR60jApa0-Abr9UDZCWtnphxXKcQwJzh6RnHfxnkuIqQtLMVRK5OMXuFEK2E_AQtQMfTldvMagR1pPnWCPXms13QR_kMaLo_gh9gxAAi3t7xfE8RY7xPUIY5cuqGYP-WxWRp_IUgJD29FOXvVtLLisTu1THMpF-g0hlc3W5wJJ67SHGGqm8w.D",
        "expires": 1635360389770,
        "ssl": true
      }

      The value for the authenticationInfo parameter is the JSON obtained from running the Generate Token operation with the "referer" property added to the JSON. For example, if you specified https://dev0017162.esri.com/arcgis as the value for the Webapp URL when generating the token, the JSON for the value of the authenticationInfo parameter should be as follows:

      Sample value for the authenticationInfo parameter

      {
        "token": "Ci4vgz18Vto2bK7mXVXLOE3XREXmt4sUI-QR60jApa0-Abr9UDZCWtnphxXKcQwJzh6RnHfxnkuIqQtLMVRK5OMXuFEK2E_AQtQMfTldvMagR1pPnWCPXms13QR_kMaLo_gh9gxAAi3t7xfE8RY7xPUIY5cuqGYP-WxWRp_IUgJD29FOXvVtLLisTu1THMpF-g0hlc3W5wJJ67SHGGqm8w.D",
        "expires": 1635360389770,
        "ssl": true,
        "referer": "https://dev0017162.esri.com/arcgis"
      }
      Caution:

      The JSON specified as the value for the authenticationInfo parameter must include the "referer" property that matches the Webapp URL value when generating the token. Otherwise, the Publish Routing Services tool will fail with an invalid token error.

    7. Click the Submit Job (POST) button.

      The Publish Routing Services tool execution starts. It may take up to an hour for the tool to complete. To monitor the tool progress while it's running, click the Check Job Details Again link to view the latest status messages. Use the Job ID value for the tool execution to check the status and results by browsing to the URL (for example, https://dev0017162.esri.com/arcgis/rest/services/System/PublishingTools/GPServer/Publish%20Routing%20Services/jobs/jd891ca3b935d4ed9a6fd38646d31a99c).

Once the tool completes, the routing services are published and configured as utility services in your enterprise portal. Allocate appropriate resources to the routing services based on the expected usage in your organization.


In this topic
  1. Example workflow