Is there a way to add polygon barriers to Network Analyst using python?

5158
10
Jump to solution
09-17-2015 09:44 AM
RachelAlbritton
Occasional Contributor III

I'm working with a Network dataset (which I did not build). The dataset has restrictions that should not allow sidewalks to be traversed through construction areas, however, network analyst is inconsistent in creating routes around these areas, sometimes sending pedestrians through construction zones, along pathways that are noted as being restricted within the network dataset. However, if I add the construction polygons manually to the Polygon barriers within the network analyst window and test routes, all routes are correct. So, now I would like to be able to add my construction layer as a barrier within my python script. Is this possible?

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
MelindaMorang
Esri Regular Contributor

Yes.  Save the barriers as a feature class and then, in your python script, add them to your NA layer using Add Locations just as you do with your Stops (or Facilities or Origins or Destinations or whatever, depending on the NA layer type).

View solution in original post

10 Replies
MelindaMorang
Esri Regular Contributor

Yes.  Save the barriers as a feature class and then, in your python script, add them to your NA layer using Add Locations just as you do with your Stops (or Facilities or Origins or Destinations or whatever, depending on the NA layer type).

RachelAlbritton
Occasional Contributor III

Thank you!

0 Kudos
NurwaWang
New Contributor

Hi Melinda. I am nurwa, a student of NCKU Taiwan. I am currently working on this thing. I've done as your description to make the barrier layer as feature first though. But I dont know why is still having a problem.

you can see the error in my attached image.

Hope you can help me

0 Kudos
RachelApplebaum
Esri Contributor

Hi Nurwa,

I don't know if this is too late, but Melinda was referring to this tool Add Locations—Help | ArcGIS Desktop , rather than the NAClassFieldMappings. Unless you're having a problem with the Add Locations as well?

-Rachel

0 Kudos
NurwaWang
New Contributor

thanks rachel for your answer. it really help me 

0 Kudos
MelindaMorang
Esri Regular Contributor

By the way, from the behavior you are describing with restrictions not being obeyed, it sounds like your network attributes (particularly the restriction attributes) might be set up incorrectly.  Perhaps before deciding for good to use barriers, you should check your attributes to make sure they are correct, in case, even with the barriers, the results might be wrong.

If you can further describe the issue you're having and give some details about your restriction attribute, I can try to help you debug the problem.

0 Kudos
RachelAlbritton
Occasional Contributor III

You're correct. Everything worked fine until 10.3 then our python script starting failing. Essentially what's happening is all the parameters are being updated in the participating layers correctly , but not all of the info is getting transferred over into the route (edges) layer. For example, if a sidewalk has been updated as to be shown as closed in the sidewalk participating layer, it may or may not show has prohibited in the edges (routes) layer that is created from the build. We can't figure out why this is all of the sudden occurring in 10.3 when we've never had the issue before. Any thoughts?

0 Kudos
MelindaMorang
Esri Regular Contributor

Hmm, I don't know why things would have changed with an upgrade to 10.3, and it sounds like this issue might be a bit complicated and not resolvable on GeoNet.  I think you would do well to call Tech Support for this issue.  They can look at your data in detail and see if they can identify what's happening.

Esri Support