Script evaluators element variables

575
3
02-13-2018 04:49 AM
sotokan80_
New Contributor III

In script evaluators how element variables work? 

The following Element Variables are available:

  • Turn
  • fromEdge
  • atJunction
  • toEdge

Does "fromEdge" mean the previous edge and "toEdge" the next edge? Is there any documentation for Element Functions such as ToAzimuth, FromPositin, PositionAlongObject etc?

0 Kudos
3 Replies
PatrickStevens
Esri Contributor

The network element script evaluators are based on the ArcObjects API.  To explain some of the sections of the dialog in your screenshot:

 

  • Element Variables: These are the objects that you can reference in the code block.  For evaluating edges, the only valid element variable is the Edge element itself.  In your screenshot, you see Turn, fromEdge, toEdge, and atJunction.  These are all network elements associated with a Turn.

 

  • Types: This changes the available functions in the Element Functions section.  For example, select Turn and you get the Angle function.  Select Junction and you get the TurnCount function.

 

I hope this was helpful.

sotokan80_
New Contributor III

Than you very much for your reply. I m trying to promote straight lines in my solver. Each street segment has a NON UNIQUE FID value. ie Richmond Avenue's street segments have FID value = 12345. Is it possible to write a script based on the following pseudocode?

a=fromEdge.AttributeValuebyName("FID")

b=toEdge.AttributeValuebyName("FID")

If a=b then dont turn

And what type of element should i use for that, turn or edge?And last but not least the edges and the junctions are evaluated based on what value(time, length)?

0 Kudos
PatrickStevens
Esri Contributor

If I understand correctly, you would like to discourage turns where possible.  I don't think what you are proposing would work with the script evaluator.  

I think some functionality that might do what you want is the Global Turn Delay Evaluator.  The purpose of that evaluator is to discourage turns by applying a cost penalty that makes turning more expensive.  That might be your answer.

To take a step back, though, why do you want to discourage turns?  Is the vehicle that is travelling too big to make many turns? If that is the case, the Global Turn Delay Evaluator seems correct.

Or are you getting routes that leave major roads and stair-steps through communities?  In this case, the best answer is probably to adjust the travel times along the roads that you prefer.