+ Reply to Thread
Results 1 to 8 of 8

Thread: adding a global turn restriction from a feature class attribute.

  1. #1
    Rob Ostwald
    Join Date
    Jul 2010
    Posts
    10
    Points
    0
    Answers Provided
    0


    0

    Default adding a global turn restriction from a feature class attribute.

    Hi,

    I've set up a network dataset in 9.2, but I'm having difficulty defining turning restrictions based on field values in the roads attribute table. In the attribute table for the roads there are 4 fields which describe if a left turn or right turn is restricted in the from-to direction and to-from direction based on digitized direction. How can I create a restriction attribute in the network dataset that evaluates the turn as restricted or not?? I thought you could use the turn.angle in an expression but the fields that contain the restriction are not listed? I've read the online help page and do not want to create a turn feature class because the values are already stored in the road centreline feature class.

    thanks for your help,

    Rob O.

  2. #2
    Alan Hatakeyama
    Join Date
    Feb 2010
    Posts
    123
    Points
    30
    Answers Provided
    5


    0

    Default Re: adding a global turn restriction from a feature class attribute.

    Hi Rob,

    The VB Script evaluator only can access attribute values on network elements; it cannot access field values on feature classes -- at least not directly. You can set up two attributes of type Descriptor to determine whether a left turn is prohibited or a right turn is prohibited, where each attribute accesses two fields (one for each direction of travel). Then you can have the logic of the VB Script evaluator access this information from these Descriptor attributes.

    Keep in mind that the VB Script evaluator parses and computes its attribute values at the time of analysis, so it can slow down your analyses.


    Alan

  3. #3
    Rob Ostwald
    Join Date
    Jul 2010
    Posts
    10
    Points
    0
    Answers Provided
    0


    0

    Default Re: adding a global turn restriction from a feature class attribute.

    Hi Alan,
    thanks for your response, but I'm not sure if I follow what your suggesting. I tried creating a network description attribute called left restriction. I used a field expression to get the value from the feature class that indicates if a left restriction occurs in the digitized direction and opposite. In the default values tab under turns I used the vbscript below:
    restricted = false
    a = Turn.Angle
    If a > 210 And a < 330 Then
    If toEdge.AttributeValueByName( "Left Restriction" ) = "LR" Then
    restricted = True
    End If
    End If

    this script did not work. I'm not clear how to use the element variable and methods. I have minimal programming experience.
    If a road feature class has attributes that indicate turn restrictions is there an alternative way to apply this to the network without manually creating a turn feature class? Creating a turn feature class is just not feasible in my situation.

    thanks,

    rob

  4. #4
    Alan Hatakeyama
    Join Date
    Feb 2010
    Posts
    123
    Points
    30
    Answers Provided
    5


    1

    Default Re: adding a global turn restriction from a feature class attribute.

    Hi Rob,

    For the Descriptor attribute you created, what was the Data Type you specified? I'm guessing Integer. The data types for network attributes are all numeric, so you're going to need to have the Field evaluator in your Descriptor attribute convert the text to a number. I'm not sure what values you have in your text fields, but you may want to convert, say, "LR" to 1 and other values to 0.

    So in the Field evaluator for your Descriptor attribute, you need to specify an expression like:
    Code:
    fieldAsInteger = 0
    Select Case [myField]
      Case "LR": fieldAsInteger = 1
    End Select
    with a return value of fieldAsInteger

    Note that the above is similar in structure to the Field evaulators used in the Oneway network attribute in the Tutorial data for Network Analyst.

    Then in the VB Script evaluator for your restriction attribute, you can specify looking for the numeric value 1:
    Code:
    restricted = false
    a = Turn.Angle
    If a > 210 And a < 330 Then
      If toEdge.AttributeValueByName( "Left Restriction" ) = 1 Then
        restricted = True
      End If
    End If
    with a return value of restricted

    Let me know if you have any further questions.


    Alan
    Last edited by ahatakeyama; 04-10-2012 at 12:58 PM.

  5. #5
    Rob Ostwald
    Join Date
    Jul 2010
    Posts
    10
    Points
    0
    Answers Provided
    0


    0

    Default Re: adding a global turn restriction from a feature class attribute.

    Hi I tried your suggestions and the scripts validate correctly but still does not create a restriction when testing using a route between 2 locations. I've attached screen shots of the network attributes and evaluator scripts.

    thanks again,
    Attached Files

  6. #6
    Alan Hatakeyama
    Join Date
    Feb 2010
    Posts
    123
    Points
    30
    Answers Provided
    5


    0

    Default Re: adding a global turn restriction from a feature class attribute.

    Hi Rob,

    In your screenshot, I only see attributes for "Distance", "Minutes", "Oneway", and "Turn Restriction". I don't see any attribute for "Left Restriction" for your VB Script evaluator to reference.

    So if you don't have a "Left Restriction" descriptor attribute (which is where the code that returns the fieldAsInteger value should be), then where are you putting that code?


    Alan

  7. #7
    Rob Ostwald
    Join Date
    Jul 2010
    Posts
    10
    Points
    0
    Answers Provided
    0


    0

    Default Re: adding a global turn restriction from a feature class attribute.

    Hi Alan,

    I got it to work

    thanks!

  8. #8
    Paul Schneider
    Join Date
    Nov 2011
    Posts
    7
    Points
    0
    Answers Provided
    0


    0

    Default Re: adding a global turn restriction from a feature class attribute.

    Hi !
    I have a similar problem.
    I was just wondering if there is a possibility to detect changes in an attribute between 2 via turn connected edges?

    For example i have a multimodal network and i want to add a delay to all possible turns that don't follow the same public transport line i'm currently driving. (e.g. changing from Bus A to another edge with Bus A will cause no delay but changing from Bus A to Bus B will cause one)

    is there a way to access within a junction evaluator not only the angle but also 1 attribute of the source and one of the destination edge?

    Thanks
    Regards,
    Paul

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts