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']}")
以下代码示例演示了如何在独立 ArcGIS Server 站点上为路径选择服务调用 GetWebToolInfo 。
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"
}
}
)