GetToolInfo

Title  GetToolInfo

Summary

Get additional information such as the description of the network dataset used for the analysis and the execution limits for a tool in the geoprocessing service.


Usage


Syntax

Parameter Explanation
serviceName

Specify the service name containing the tool. The parameter value should be specified using one of the following keywords that reference a particular geoprocessing service.

  • asyncClosestFacility—The asynchronous geoprocessing service used to perform the closest facility analysis.
  • asyncLocationAllocation—The asynchronous geoprocessing service used to perform the location-allocation analysis.
  • asyncRoute—The asynchronous geoprocessing service used to perform the route analysis.
  • asyncServiceArea—The asynchronous geoprocessing service used to perform the service area analysis.
  • asyncVRP—The asynchronous geoprocessing service used to perform the vehicle routing problem analysis.
  • syncVRP—The synchronous geoprocessing service used to perform the vehicle routing problem analysis.
  • asyncODCostMatrix— The asynchronous geoprocessing service used to perform the origin destination cost matrix analysis.

The default value is asyncRoute.

toolName

Specify the tool name in the geoprocessing service. The parameter value should be a valid tool name in the geoprocessing service specified by the serviceName parameter. Valid tool names are

  • FindClosestFacilities for asyncClosestFacility service
  • SolveLocationAllocation for asyncLocationAllocation service
  • FindRoutes for Route service
  • GenerateServiceAreas for asyncServiceArea service
  • SolveVehicleRoutingProblem for asyncVRP service
  • EditVehicleRoutingProblem for syncVRP service
  • GenerateOriginDestinationCostMatrix for asyncODCostMatrix service

The default value is FindRoutes.

Code Samples

GetToolInfo example

The following Python script demonstrates how to use the GetToolInfo tool in a script.


'''
The script shows how to use the GetToolInfo tool to get the maximum number of stops
that can be used as inputs with FindRoutes tool.
'''
import sys
import json

import arcpy

#Change the username and password applicable to your own ArcGIS Online account
username = "<your user name>"
password = "<your password>"

utility_service = "https://logistics.arcgis.com/arcgis/services;World/Utilities;{0};{1}".format(username, password)

#Add the geoprocessing service as a toolbox.
arcpy.ImportToolbox(utility_service)

#Call the tool to get the limits for the FindRoutes tool 
result = arcpy.Utilities.GetToolInfo("asyncRoute", "FindRoutes")

#Print any warning or error messages returned from the tool
result_severity = arcpy.GetMaxSeverity()
if result_severity == 2:
    arcpy.AddMessage("An error occured when running the tool")
    arcpy.AddMessage(arcpy.GetMessages(2))
    sys.exit(2)
elif result_severity == 1:
    arcpy.AddMessage("Warnings were returned when running the tool")
    arcpy.AddMessage(arcpy.GetMessages(1))

#Retrieve the tool info and convert it to a dictionary
output_tool_info_json = result.getOutput(0)
output_tool_info_dict = json.loads(output_tool_info_json)

#Retrieve the maximum number of stops allowed by the service
max_stops = int(output_tool_info_dict["serviceLimits"]["maximumStops"])
arcpy.AddMessage("The maximum number of stops supported by the FindRoutes tool: {}" .format(max_stops))
                    

Tags

service limits, network description, network dataset description

Credits

Use limitations

This tool is available for users with an ArcGIS Online organizational subscription. To access this geoprocessing tool, you'll need to sign in with an account that is a member of an organizational subscription. Executing this tool does not incur service credits.