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 — выдает информацию о наборе сетевых данных, используемых веб-инструментом
  • serviceLimits — выдает пределы использования веб-инструмента

Пример кода

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']}")