Network analyst - turn feature class

511
1
04-18-2021 06:17 AM
MirjanaAndjelic
New Contributor

Hi,

I am using ArcMao 10.7.1. I have the following layers:

1. line - which are streets (attributes: ID, Name, Time, Length )

2. points - which are crossroads (attributes: ID, Name)

3. turn feature class - which says about the prohibition of turning (attributes created by the archmap: ID, Shape, Edge1End, Edge1FCID, Edge1FID, Edge1Pos,Edge2End, Edge2FCID, Edge2FID, Edge2Pos... + TURN - which is 0 or -1 ).   TURN attribute values mean: 0 - turning between the first line (id: Edge1FID) and the second line (id: Edge2FID ) is allowed,  -1 - turning between the first line (id Edge1FID) and the second line (id: Edge2FID) is not allowed.

I creatred: GDB, Feature Dataset and finally Network Dataset. In the Attribute tab, I created some new attributes: Length (which I am going to use as cost for calculating navigation), Time (which I am going to use as cost for calculating navigation) and Turn (which  will say about the prohibition of turning). 
To define Turn, I usef Python code. In the Evaluators tab, I set: Source - Turn, Element -Turn, Type - Field and Value - expression (Python code below):

python

----------------------------------

defSetOneway(value):

              restricted = False

               if value = -1:

                            restricted = True

              return restricted

--------------------------------------

SetOneway("TURN")

When I started calculating the route, the program does not recognize the forbidden turns, which I defined via TURN. Does anyone know why?

 

0 Kudos
1 Reply
MirjanaAndjelic
New Contributor

Sorry, i wrote the wrong code.
I used, tihis one:

def Turn(value):

           restricted = False

           if value == -1:

                   restricted = True

           return restricted

--------------------

Turn(!TURN!)

0 Kudos