How to access the Route sublayer properties in arcpy

06-30-2013 12:50 PM
New Contributor
After solving a route, I need to read the properties of the Route class. Concretely the Total_[Impedance] field as I want to compare different routes with regard to this attribute. Is there any way to do this with arcpy?

My code until this step is typical:

route_lyr =,"BestRoute", "Length", output_path_shape="TRUE_LINES_WITH_MEASURES")
route_lyr = route_lyr.getOutput(0)
sub_layers ="BestRoute",sub_layers["Stops"],"stops.shp")

Then I thought about the following to get the Total_Length value of the solve result:

for lyr in arcpy.mapping.ListLayers(route_lyr):
    [INDENT]if == "Routes":
        [INDENT]print lyr.longName                                      # Printed just for explanatory purposes
        sCursor = arcpy.SearchCursor(lyr.longName)   # "BestRoute\Routes" is passed. The error is thrown here
        while sCursor:
            [INDENT]row =
            cost = row.getValue("Total_Length")
            print cost[/INDENT]

Which prints to standard output:

An error occurred on line XXX
"BestRoute\Routes" does not exist

So "BestRoute\Routes" is the long name of the Routes layer but (apparently) not the input that SearchCursor expects. Generic layer properties (longName, isBroken...) can be accessed with my code, but not those network-related.

I guess I'm missing the mechanism to access the network properties of the sublayer Routes that is stored in the composite layer...

Any help would be much appreciated.
Tags (2)
0 Kudos
1 Reply
New Contributor
I just realized I posted this in the wrong Forum. Apologies for that.
0 Kudos