GetWebToolInfo

摘要

返回用于分析的网络数据集的说明以及在门户注册的路径实用程序服务中某一工具的执行限制。

说明

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. If a value is not specified, the active portal URL will be used.

(默认值为 None)

String
返回值
数据类型说明
Dictionary

GetWebToolInfo 对象的键值对。

  • isPortal - GetWebToolInfo 字典对象关键字。
  • networkDataset - 提供有关 web 工具使用的网络数据集的信息。
  • serviceLimits - 提供对 web 工具的限制。

代码示例

GetWebToolInfo 示例 1

以下代码示例可显示如何从活动门户获取服务区实用程序服务支持的最大设施点数量。

# 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}")
GetWebToolInfo 示例 2

以下代码示例可显示如何从网络数据源打印所有成本属性的流量支持类型。

# The following code sample shows how to print the traffic support type for all the cost attributes from your
# network data source.

import arcpy

# Get the active portal url
portal_url = arcpy.GetActivePortalURL()
print(f"Active portal: {portal_url}")

# Get the network dataset description from the active portal
tool_info = arcpy.na.GetWebToolInfo("asyncRoute","FindRoutes")
nd_info = tool_info["networkDataset"]
for attribute in nd_info["networkAttributes"]:
    if attribute["usageType"] == "Cost":
        print(f"{attribute['name']}: {attribute['trafficSupport']}")