Available with Network Analyst license.
Summary
Updates the network attribute parameter value for a network analysis layer. The tool should be used to update the value of an attribute parameter for a network analysis layer prior to solving with the Solve tool. This ensures that the solve operation uses the specified value of the attribute parameter to produce appropriate results.
Usage
Parameterized network attributes are used to model some dynamic aspect of an attribute's value. For example, a tunnel with a height restriction of 12 feet can be modeled using a parameter. In this case, the vehicle's height in feet should be specified as the parameter value. This restriction will then evaluate to true if the vehicle is higher than 12 feet. Similarly, a bridge could have a parameter to specify a weight restriction.
This tool should only be used with network analysis layers having network attributes with parameters defined on them.
This tool can be used to repeatedly change the value of an existing parameter before solving a network analysis layer.
New attribute parameters can be created from the network dataset properties dialog box in the Catalog window or in ArcCatalog.
Syntax
UpdateAnalysisLayerAttributeParameter_na (in_network_analysis_layer, parameterized_attribute, attribute_parameter_name, {attribute_parameter_value})
Parameter | Explanation | Data Type |
in_network_analysis_layer | Network analysis layer for which the attribute parameter value will be updated. | Network Analyst Layer |
parameterized_attribute | The network attribute whose attribute parameter will be updated. | String |
attribute_parameter_name | The parameter of the network attribute that will be updated. The parameters of type Object cannot be updated using the tool. | String |
attribute_parameter_value (Optional) | The value that will be set for the attribute parameter. It can be a string, number, date, or Boolean (True, False). If the value is not specified, then the attribute parameter value is set to Null. If the attribute parameter has a restriction usage type, the value can be specified as a string keyword or a numeric value. The string keyword or the numeric value determines whether the restriction attribute prohibits, avoids, or prefers the network elements it is associated with. Furthermore, the degree to which network elements are avoided or preferred can be defined by choosing HIGH, MEDIUM, or LOW keywords. The following keywords are supported:
Numeric values that are greater than one cause restricted elements to be avoided; the larger the number, the more the elements are avoided. Numeric values between zero and one cause restricted elements to be preferred; the smaller the number, the more restricted elements are preferred. Negative numbers prohibit restricted elements. | String |
Code sample
UpdateAnalysisLayerAttributeParameter example 1 (Python window)
Execute the tool using all the parameters.
arcpy.na.UpdateAnalysisLayerAttributeParameter("Route", "Height Restriction",
"Vehicle Height (feet)", 12.0)
UpdateAnalysisLayerAttributeParameter example 2 (workflow)
The following stand-alone Python script demonstrates how the Update Analysis Layer Attribute Parameter tool can be used to find the best route for trucks that avoid low clearance overpasses or tunnels, avoid toll roads, and prefer designated truck routes.
# Name: UpdateAnalysisLayerAttributeParameter_Workflow.py
# Description: Use the network dataset's length and height restriction attribute
# parameters to find a route suitable for transporting a large
# wind turbine blade. The results are saved to a layer file.
# Requirements: Network Analyst Extension
#Import system modules
import arcpy
from arcpy import env
import os
try:
#Check out the Network Analyst extension license
arcpy.CheckOutExtension("Network")
#Set environment settings
env.workspace = "C:/Data/SanDiego.gdb"
env.overwriteOutput = True
#Set local variables
network = "Transportation/Streets_ND"
layer_name = "WindTurbineRoute"
impedance = "Meters"
restrictions = ["Driving a Truck", "Height Restriction", "Oneway",
"Length Restriction", "National STAA and Locally Preferred Routes"]
seaport = "Analysis/Port"
wind_farm = "Analysis/WindFarm"
output_layer_file = os.path.join(r"C:/Data", layer_name + ".lyr")
#Make a new route layer. Use restriction attributes relevant to trucking
#oversize loads
result_object = arcpy.na.MakeRouteLayer(network, layer_name, impedance,
restriction_attribute_name=restrictions)
#Get the layer object from the result object. The route layer can
#now be referenced using the layer object.
layer_object = result_object.getOutput(0)
#Set the vehicle height and length attribute parameters to the dimensions of
#the wind turbine transport truck. If these dimensions exceed the limits
#associated with a street feature, that street will be restricted, and the
#resulting route will avoid it.
arcpy.na.UpdateAnalysisLayerAttributeParameter(layer_object,
"Height Restriction", "Vehicle Height (feet)", 13.25)
arcpy.na.UpdateAnalysisLayerAttributeParameter(layer_object,
"Length Restriction", "Vehicle Length (feet)", 80)
#Load the origin and destination points as Stops in the Route
sublayer_names = arcpy.na.GetNAClassNames(layer_object)
stops_layer_name = sublayer_names["Stops"]
arcpy.na.AddLocations(layer_object, stops_layer_name, seaport, "", "")
arcpy.na.AddLocations(layer_object, stops_layer_name, wind_farm, "", "",
append="APPEND")
#Solve the route layer
arcpy.na.Solve(layer_object)
#Save the solved route layer as a layer file on disk
arcpy.management.SaveToLayerFile(layer_object, output_layer_file,
"RELATIVE")
print "Script completed successfully"
except Exception as e:
# If an error occurred, print line number and error message
import traceback, sys
tb = sys.exc_info()[2]
print "An error occured on line %i" % tb.tb_lineno
print str(e)
Environments
Licensing information
- ArcGIS Desktop Basic: Yes
- ArcGIS Desktop Standard: Yes
- ArcGIS Desktop Advanced: Yes