Zusammenfassung
Returns the description of the network dataset used for the analysis and the run limits for a tool in the routing utility services registered with your portal or stand-alone ArcGIS Server site.
Diskussion
The GetWebToolInfo function allows you to get the tool limits or information for the network data source used by your portal.
Syntax
GetWebToolInfo (service_name, tool_name, {portal_url})
Parameter | Erläuterung | Datentyp |
service_name | The name of the service containing the web tool. Valid values are as follows:
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:
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. (Der Standardwert ist None) | String |
Datentyp | Erläuterung |
Dictionary | The GetWebToolInfo object key-value pairs.
|
Codebeispiel
The following code sample shows how to get the maximum number of facilities supported by the Service Area utility service from your active portal.
# 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}")
The following code sample shows how to print the traffic support type for all the cost attributes from your network data source. The portal URL is specified explicitly.
# 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']}")
The following code sample shows how to call GetWebToolInfo for a routing service on a stand-alone ArcGIS Server site.
Learn more about how to specify a routing service info dictionary
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"
}
}
)