摘要
返回用于分析的网络数据集的说明以及在门户或独立 ArcGIS Server 站点注册的路径实用程序服务中某一工具的运行限制。
说明
GetWebToolInfo 函数可用于获取门户使用的网络数据源的工具限制或信息。
语法
GetWebToolInfo (service_name, tool_name, {portal_url})
参数 | 说明 | 数据类型 |
service_name | The name of the service containing the web tool. Valid values are asyncClosestFacility, asyncLocationAllocation, asyncODCostMatrix, asyncRoute, asyncServiceArea, asyncVRP, and syncVRP. The values are case-sensitive. If the service_name value is not in the list of supported values, a ValueError occurs. | String |
tool_name | The name of the web tool. Valid values are EditVehicleRoutingProblem, FindClosestFacilities, FindRoutes, GenerateOriginDestinationCostMatrix, GenerateServiceAreas, SolveLocationAllocation, and SolveVehicleRoutingProblem. The values are case-sensitive. A ValueError occurs if the tool_name value is not in the list of supported values. | String |
portal_url | The URL of the portal containing the service or a dictionary specifying connection information for a routing service on a stand-alone ArcGIS Server site. If a value is not specified, the active portal URL will be used. (默认值为 None) | String |
数据类型 | 说明 |
Dictionary | GetWebToolInfo 对象的键值对。
|
代码示例
以下代码示例可显示如何从活动门户获取服务区实用程序服务支持的最大设施点数量。
# The following code sample shows how to get the maximum number of facilities supported by the Service Area utility
# service from your active portal.
import arcpy
# Get the active portal url
portal_url = arcpy.GetActivePortalURL()
print(f"Active portal: {portal_url}")
# Get the tool limits for the tool from the active portal
tool_info = arcpy.na.GetWebToolInfo("asyncServiceArea", "GenerateServiceAreas")
max_facilities = tool_info["serviceLimits"]["maximumFacilities"]
print(f"Maximum facilities: {max_facilities}")
以下代码示例可显示如何从网络数据源打印所有成本属性的流量支持类型。 门户 URL 显式指定。
# The following code sample shows how to print the traffic support type for all
# the cost attributes from the arcgis.com routing service.
import arcpy
tool_info = arcpy.na.GetWebToolInfo(
"asyncRoute", "FindRoutes", "https://www.arcgis.com/")
nd_info = tool_info["networkDataset"]
for attribute in nd_info["networkAttributes"]:
if attribute["usageType"] == "Cost":
print(f"{attribute['name']}: {attribute['trafficSupport']}")
以下代码示例演示了如何在独立 ArcGIS Server 站点上为路径选择服务调用 GetWebToolInfo。
tool_info = arcpy.na.GetWebToolInfo(
"asyncODCostMatrix", "GenerateOriginDestinationCostMatrix",
{
"utilityUrl": f"https://mysite.mydomain.com/:6443/arcgis/rest/services/MyRouting/NetworkAnalysisUtilities/GPServer",
"authenticationInfo": {
"username": "my_username",
"password": "my_password"
}
}
)