GetWebToolInfo

Synthèse

Returns the description of the network dataset used for the analysis and the execution limits for a tool in the routing utility services registered with your portal.

Discussion

The GetWebToolInfo function allows you to get the tool limits or information for the network data source used by your portal.

Syntaxe

GetWebToolInfo (service_name, tool_name, {portal_url})
ParamètreExplicationType de données
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.

(La valeur par défaut est None)

String
Valeur renvoyée
Type de donnéesExplication
Dictionary

The GetWebToolInfo object key-value pairs.

  • isPortal—The GetWebToolInfo dictionary object keys.
  • networkDataset—Provides the information about the network dataset used by the web tool.
  • serviceLimits—Provides the limits for the web tool.

Exemple de code

GetWebToolInfo example 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.

# 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}")
GetWebToolInfo example 2

The following code sample shows how to print the traffic support type for all the cost attributes from your network data source.

# 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.nax.GetWebToolInfo("asyncRoute","FindRoutes")
nd_info = tool_info["networkDataset"]
for attribute in nd_info["networkAttributes"]:
    if attribute["usageType"] == "Cost":
        print(f"{attribute['name']}: {attribute['trafficSupport']}")