U-turn policy question

4051
7
Jump to solution
07-30-2015 11:40 AM
thomasbales
Occasional Contributor

I am trying to model u-turns on a railway. I know how to do this by using u-turn restrictions at each node. However, this is going to be a superman type feat and it would be much easier if I could turn off u-turns altogether and model a feature to allow a u-turn instead of restrict it. Is there a way to do this in a network dataset?

0 Kudos
1 Solution

Accepted Solutions
PatrickStevens
Esri Contributor

Hi, Thomas!  I've been discussing this issue with colleagues.  We came up with a solution we think might work.

1.  Make all of the junctions you want to ALLOW u-turns as user-defined junctions.

You can select that set of system junctions, export it as a feature class in the same feature dataset as your network, then add it as a source to your network.

2. Add a descriptor attribute to your network called something like uturn_restricted_at_junction.

     a. Set the descriptor to boolean

     b. Set the default junction evaluator value to a constant of true

     c. Set the source junction evaluator value for your user junctions to a constant of false

3. Make a restriction attribute on your network called something like restricted_uturns

     a. Set the type to boolean

     b. On the default evaluator for turns, set it to script and add this python script:

In the pre-logic script code, put:

def SetValue():

  is_restricted = False

  if fromEdge.EID == toEdge.EID:

    is_restricted = atJunction.AttributeValueByName( "uturn_restricted_at_junction" )

  return is_restricted

if the value = part, put:

SetValue()

4. Make sure you already have a turn feature class in your network.  For my toy network, I added an empty one.  Seems like a turn source is required to get this to work, even if there is nothing in the source feature class.

Then, test that it works!  I tried this on a toy network and it worked.  Uturns at my user junctions were allowed and uturns at my system junctions were not allowed.

You can test it by adding a stop near a test junction on the right side on the edge.  Set the curbapproach for the stop to right. 

Then, add a second stop farther away from the test junction, so that the route has to leave stop1 towards the junction and the quickest route would be a uturn at the test junction back to stop2.

I hope all of this makes sense.  Good luck!

View solution in original post

7 Replies
MelindaMorang
Esri Regular Contributor

You can just set the U-Turn policy of your Network Analysis layer to "Not Allowed".  This is an NA layer setting rather than something you build into your network dataset.

U-turn policies—Help | ArcGIS for Desktop

thomasbales
Occasional Contributor

Thanks for such a quick response, I may have not been clear. I have thousands of miles of track and a few thousand nodes. Most of these nodes (dead ends and intersections) must not allow u-turns, but I have about a hundred or so that should allow a u-turn. Basically a Y in the rail system.

So if I turn on the policy I am going to have to model a few thousand U-turn restrictions. Is there a reverse operation where I can turn off the U-turn policy and only model the U-turn exceptions?

Again, thanks for your response, I know I am missing something simple.

PatrickStevens
Esri Contributor

Hi, Thomas!  I've been discussing this issue with colleagues.  We came up with a solution we think might work.

1.  Make all of the junctions you want to ALLOW u-turns as user-defined junctions.

You can select that set of system junctions, export it as a feature class in the same feature dataset as your network, then add it as a source to your network.

2. Add a descriptor attribute to your network called something like uturn_restricted_at_junction.

     a. Set the descriptor to boolean

     b. Set the default junction evaluator value to a constant of true

     c. Set the source junction evaluator value for your user junctions to a constant of false

3. Make a restriction attribute on your network called something like restricted_uturns

     a. Set the type to boolean

     b. On the default evaluator for turns, set it to script and add this python script:

In the pre-logic script code, put:

def SetValue():

  is_restricted = False

  if fromEdge.EID == toEdge.EID:

    is_restricted = atJunction.AttributeValueByName( "uturn_restricted_at_junction" )

  return is_restricted

if the value = part, put:

SetValue()

4. Make sure you already have a turn feature class in your network.  For my toy network, I added an empty one.  Seems like a turn source is required to get this to work, even if there is nothing in the source feature class.

Then, test that it works!  I tried this on a toy network and it worked.  Uturns at my user junctions were allowed and uturns at my system junctions were not allowed.

You can test it by adding a stop near a test junction on the right side on the edge.  Set the curbapproach for the stop to right. 

Then, add a second stop farther away from the test junction, so that the route has to leave stop1 towards the junction and the quickest route would be a uturn at the test junction back to stop2.

I hope all of this makes sense.  Good luck!

thomasbales
Occasional Contributor

Thanks for your help Patrick,

I think I understand how to accomplish this, But it would be easier if I could have look at your test network. Would it be possible for you zip it and ship it?

Thanks for all the time and effort you and your colleagues put into this.

0 Kudos
PatrickStevens
Esri Contributor

Sure, I'd be happy to send it along.  Unfortunately, I can't figure out how to post a zip or 7z here to the forums.  Could you email me and I'll send it?  As a 7z, it is only 22 KB.

My email is pstevens at esri.com.

I tried to use GeoNet's upload file option, but it gives me the less-than-helpful message, "You are not allowed to create or update this content".

0 Kudos
thomasbales
Occasional Contributor

Hi Patrick, my email is thomas.i.bales@loram.com

Thomas Bales

GIS Analyst

Loram Maintenance of Way, Inc.

3900 Arrowhead Drive

Hamel, Minnesota 55340

763-478-5965

0 Kudos
thomasbales
Occasional Contributor

Worked perfectly, thanks Patrick.

0 Kudos