GetWebToolInfo

摘要

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

说明

GetWebToolInfo 函数可用于获取门户使用的网络数据源的工具限制或信息。

语法

GetWebToolInfo (service_name, tool_name, {portal_url})
参数说明数据类型
service_name

The name of the service containing the web tool.

Valid values are as follows:

  • asyncClosestFacility
  • asyncFleetRouting
  • asyncLocationAllocation
  • asyncODCostMatrix
  • asyncRoute
  • asyncServiceArea
  • asyncVRP
  • syncVRP

The values are case sensitive. A ValueError occurs if the service_name value is not in the list of supported values.

String
tool_name

The name of the web tool.

Valid values are as follows:

  • EditVehicleRoutingProblem
  • FindClosestFacilities
  • FindRoutes
  • GenerateOriginDestinationCostMatrix
  • GenerateServiceAreas
  • SolveLastMileDelivery
  • SolveLocationAllocation
  • 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 no value is provided, 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

以下代码示例可显示如何从网络数据源打印所有成本属性的流量支持类型。 门户 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']}")
GetWebToolInfo 示例 3

以下代码示例演示了如何在独立 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"
        }
    }
)