Get information such as the description of the network dataset used for the analysis and the execution limits for a tool in the geoprocessing service.
The tool is meant to be used before executing other tools in the geoprocessing service. For example, if you need to identify the maximum number of stops supported by the FindRoutes tool, you can run GetToolInfo to determine the limit.
Parameter | Explanation |
---|---|
serviceName |
The service name containing the tool. The parameter value should be specified using one of the following keywords that reference a particular geoprocessing service:
The default value is asyncRoute. |
toolName |
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 as follows:
The default value is FindRoutes. |
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))
There are no tags for this item.
There are no credits for this item.
There are no use limitations for this item.