概要
解析に使用されるネットワーク データセットの説明や、ジオプロセシング サービスのツールに関する実行制限などの情報を取得します。
使用法
このツールは、ジオプロセシング サービスでその他のツールを実行する前に使用するように意図されています。たとえば、FindRoutes ツールによってサポートされているストップの最大数を特定する必要がある場合、GetToolInfo を実行して制限を確認することができます。
構文
arcpy.naagol.GetToolInfo(serviceName, toolName)
パラメーター | 説明 | データ タイプ |
serviceName | ツールを含んでいるサービス名。このパラメーターの値は、特定のジオプロセシング サービスを参照する以下のキーワードのいずれかを使用して指定する必要があります。
デフォルト値は asyncRoute です。 | String |
toolName | ジオプロセシング サービスのツール名。パラメーター値は、serviceName パラメーターで指定されたジオプロセシング サービスにおいて有効なツール名である必要があります。有効なツール名は次のとおりです。
デフォルト値は FindRoutes です。 | String |
派生した出力
名前 | 説明 | データ タイプ |
toolInfo | ジオプロセシング サービスのツールに関する追加情報。 | String |
コードのサンプル
GetToolInfo (ツール情報の取得) の例
次の Python スクリプトは、GetToolInfo ツールをスクリプトで使用する方法を示しています。
'''
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))
環境
このツールは、ジオプロセシング環境を使用しません。