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:
The values are case sensitive. A |
String |
||||||||||||||||||
|
tool_name |
The name of the web tool. Valid values for each
The values are case sensitive. A |
asyncClosestFacility |
||||||||||||||||||
|
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 |
Пары ключ-значение объекта
|
Пример кода
В следующем коде показано, как получить максимальное число пунктов обслуживания, поддерживаемое утилитой Область обслуживания вашего активного портала.
# 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.nax.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.nax.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 для службы маршрутизации на автономном сайте ArcGIS Server.
Узнайте больше о том, как указать информационный словарь сервисов маршрутизации.
tool_info = arcpy.nax.GetWebToolInfo(
"asyncODCostMatrix", "GenerateOriginDestinationCostMatrix",
{
"utilityUrl": f"https://mysite.mydomain.com/:6443/arcgis/rest/services/MyRouting/NetworkAnalysisUtilities/GPServer",
"authenticationInfo": {
"username": "my_username",
"password": "my_password"
}
}
)