# Incorporating Length of Route Value into Cost Evaluator Function

588
2
11-21-2010 06:12 PM
Highlighted
New Contributor III
A friend and I are creating a walking network and we have run in to a snag. We would like to attribute a cost evaluator to our network dataset using a self determined safety metric. We have the equation set up so that all we need to do is divide a field value based on the length of a route to get our "safety value". We just need to know in the cost field how to write the vb script or other evaluator so that Cost Value=[FieldValue]/"total length of individual route". Each route length will be different once each analysis is run, but we have a length value for each line segment, so we know there should be a way that adds up these pieces for the route for a total route length that can be divided by our field value. It seems like it should be a simple script line or something to put in the field evaluator box. Any suggestions?

We are using Arc10.
Tags (2)
2 Replies
Highlighted
New Contributor III
I was able to get this to work, but I lack the necessary programming skills to get it 100% correct. I calculated my value by multiplying the length of each segment by a designated number, where 1 was most desirable. Theoretically, when divided by the length, this would produce a value that, the closer to 1 would indicate a more desirable route. In the field evaluator value dialogue box, I was able divide my calculated value by the length of the segment. I was hoping that they would sum each field first and then divide the two values.

However, when I ran the route analysis, the values were dividing each time, and summing all of the individually divided values at the end. I would like each field (my value and the length) to sum first, then divide the two summed fields to produce a value. What would be the VB sript or other relevant code to put in the Prelogic or VB function dialogue box to have them run in this order instead of the order they currently are?
Highlighted
by Esri Regular Contributor
It is not clear what you are trying to achieve. A shortest path solver will find a path with minimum "impedance" and sum that up as the total impedance of that path when writing the output. Perhaps you can explain it a bit more (big picture) of what you want to achieve.
Jay Sandhu 