# Network Analyst With Centroid Connectors

I have a fairly straight forward routing problem that I cannot seem to solve with the various Network Analyst tools available to me. We have categorized our street network according to the level of traffic stress one experiences while biking (colored lines in the image below). The goal of this analysis is to calculate the network distance between the top trip producing census blocks (green points in the image below) and top trip attracting census blocks (red point in the image below). This would be done twice, once for all levels of traffic stress and once for only minimal levels of traffic stress so a comparison can be made.

In order to "connect" the census block centroids to the network, I created connectors (the gray lines emanating from the points) and integrated them into our network. The number of connectors was based on how many network segment midpoints fell along the border of the census block. I have weighted these connects with 0 cost which was a decision made by our research team. The problem I am having, is that the route algorithm obviously searches for the route that costs the least (black line below) causing the route to traverse multiple centroid connectors and avoiding the network all together. I have introduced turn restrictions (see the red lines adjacent to the origin of the trip below) that restricts movement through two connectors. This appears to work, but would mean I would have to build turn lines for each pair of connectors in my network!

Does anyone know of an alternative solution to this problem? If there was a way to tell Network Analyst to never pass through a centroid or to only traverse one connector for any given route solution. I cannot think of a way to do this. Any ideas?

With a little inspiration from Melinda over in Esri's GeoNet forum I was able to implement the following script evaluator for my cost attribute under the default tab for turns. My logic behind the syntax is that if a route is attempting to traverse from one segment that is classified as a connector to another segment that is classified as a connector, the movement is restricted. I added a descriptor attribute to my network entitled "Connector" which is coded as 1 if it is a centroid connector. After implementing this logic the route stayed on the network until it reached the connector to the destination.

``````restricted = False
a = Turn.Angle
If a >= 0 Then
If fromEdge.AttributeValueByName( "Connector" )= 1 And toEdge.AttributeValueByName("Connector") = 1 Then
restricted = True
End If
End If

Value = restricted
``````

We took a slightly different approach. We made the travel time (or cost) for using a connector arbitrarily high--1000 hours for each connector. This forced the route-finding algorithm to avoid centroid connectors wherever possible; each route uses exactly 2 centroid connectors. Then in post processing, we subtracted 2*1000 hours from the travel time, reducing the effective cost of centroid connectors to zero.

The only drawback is that adjacent nodes (nodes whose centroid connectors attach to the same network point) show a final cost of zero.