AnsweredAssumed Answered

Network Analyst and Script Evaluators:  accessing attributes, get "network element evaluator error"

Question asked by brads98 on May 6, 2018
Latest reply on Jun 22, 2018 by cribeiro

I'm trying to create a route using Network Analyst.  Just at the beginning stages of setting this up for a school project.

 

I have a feature class called RoadsClipped, and successfully set up a Network Dataset called Roads_ND using it.

 

Now I'm trying to customize the routing cost using evaluators.  I want to use attributes in RoadsClipped, but anything I've tried to access those attributes results in a "Network element evaluator error".  I've tried both VBScript and Python.

 

Some simple examples are below.  I've tried literally hundreds of variations and nothing work unless I forego trying to look at the attribute entirely.  These are just simple tests to see if I can get at the attributes in RoadsClipped, and not the real logic I'll eventually use.

 

Python:

 

def SetCost(value):
    a=Edge.AttributeValueByName(value)
    c=0
    if l!=0:
        c=100/a
    return c

 

value=SetCost("SPEED_LIM")

 

VBScript:

 

a=0
a=Edge.AttributeValueByName("SPEED_LIM")

 

value = a

 

Any suggestions?

Outcomes