Update Analysis Layer Attribute Parameter (Network Analyst)


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.



UpdateAnalysisLayerAttributeParameter_na (in_network_analysis_layer, parameterized_attribute, attribute_parameter_name, {attribute_parameter_value})
ParameterExplanationData Type

Network analysis layer for which the attribute parameter value will be updated.

Network Analyst Layer

The network attribute whose attribute parameter will be updated.


The parameter of the network attribute that will be updated. The parameters of type Object cannot be updated using the tool.


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 parameter value holds an array, separate the items in the array with whatever the localized separator character is currently set to. For example, in the U.S., you would most likely use the comma character to separate the items. So representing an array of three numbers might look like "5,10,15".


Code Sample

UpdateAnalysisLayerAttributeParameter example 1 (Python window)

Execute the tool using all the parameters.

import arcpy
UpdateAnalysisLayerAttributeParameter example 2 (workflow)

The following stand-alone Python script demonstrates how the UpdateAnalysisLayerAttributeParameter tool can be used to find the best route that avoids low clearance overpasses or tunnels for certain vehicles.

# Name: UpdateAnalysisLayerAttributeParameter_Workflow.py
# Description: Find the best route that avoids low clearance overpasses or 
#              tunnels for certain vehicles and save results to a layer file.
# Requirements: Network Analyst Extension 
# Author: ESRI

#Import system modules
import arcpy
from arcpy import env

    #Check out the Network Analyst extension license

    #Set environment settings
    env.workspace = "C:/data/RhodeIsland.gdb"
    env.overwriteOutput = True
    #Set local variables
    inNetworkDataset = "Transportation/Streets_ND"
    outNALayer = "BestTruckRoute"
    impedanceAttribute = "TravelTime"
    accumulateAttribute = ['Length']
    parameterizedAttribute = "HeightRestriction"    
    restrictions = ["Oneway", parameterizedAttribute, "TurnRestriction"]
    searchTolerance = "2000 Meters"
    parameterName = "VehicleHeight"
    truckHeight = 15
    inStops = "Analysis/DeliveryLocations"
    outLayerFile = "C:/data/output" + "/" + outNALayer + ".lyr"
    #Make a new route layer. Along with the total travel time, we also want to
    #find out the total distance. So we accumulate "Length" attribute. We want 
    #to obey the oneway, turn restrictions and since we are routing trucks that
    #need a particular clearence, we want to use Height restriction.
    arcpy.MakeRouteLayer_na(inNetworkDataset, outNALayer, impedanceAttribute, 
                            "", "", "", accumulateAttribute,"NO_UTURNS",
    #Load the Delivery locations as stops using default field map
    arcpy.AddLocations_na(outNALayer, "Stops", inStops, "", searchTolerance)
    #As we wish to route trucks which require a clearance of 15 meters,
    #we will set the VehicleHeight parameter on HeightRestriction attribute.
    #This would mean that all streets which have a clearance of less than 15 
    #meters will be restricted.
                                                   parameterName, truckHeight)
    #Solve the route layer
    #Save the solved route layer as a layer file on disk using relative paths
    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)


Related Topics

Licensing Information

ArcView: Requires Network Analyst
ArcEditor: Requires Network Analyst
ArcInfo: Requires Network Analyst

Published 6/7/2010