Resumen
Obtenga información como la descripción del dataset de red que se usa para los límites de análisis y ejecución para una herramienta en el servicio de geoprocesamiento.
Uso
La herramienta está diseñada para usarse antes de ejecutar otras herramientas del servicio de geoprocesamiento. Por ejemplo, si debe identificar el número máximo de paradas admitido por la herramienta FindRoutes, puede ejecutar GetToolInfo para determinar el límite.
Sintaxis
arcpy.naagol.GetToolInfo(serviceName, toolName)
Parámetro | Explicación | Tipo de datos |
serviceName | El nombre de servicio que contiene la herramienta. El valor del parámetro se puede especificar con una de las siguientes palabras clave que hacen referencia a un servicio de geoprocesamiento particular:
El valor predeterminado es asyncRoute. | String |
toolName | El nombre de la herramienta en el servicio de geoprocesamiento. El valor del parámetro debe ser un nombre de herramienta válido en el servicio de geoprocesamiento especificado por el parámetro serviceName. Los nombres de herramienta válidos son los siguientes:
El valor predeterminado es FindRoutes. | String |
Salida derivada
Nombre | Explicación | Tipo de datos |
toolInfo | Información adicional sobre una herramienta en el servicio de geoprocesamiento. | Cadena |
Muestra de código
Ejemplo de GetToolInfo
El siguiente script de Python muestra cómo usar la herramienta GetToolInfo en un 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))
Entornos
Esta herramienta no utiliza ningún entorno de geoprocesamiento.