Delete locations (Stops and Barriers) using Model Builder/ Python

824
2
05-19-2017 12:52 PM
Highlighted
New Contributor

Is there any way to delete locations (Stops and Barriers) using Model Builder/ Python from my analysis layer?

Tags (1)
Reply
0 Kudos
2 Replies
Highlighted
Esri Regular Contributor

You can use Delete Features to delete all or a selection of locations, just as you would for a normal layer:

Delete Features—Help | ArcGIS Desktop 

The trick is how to access the sublayer (like Stops or Point Barriers).  In Model Builder, you can use the Select Data utility to grab the sublayer from the network analysis layer.  In python, the syntax depends on whether you're using ArcMap or Pro, but it involves doing listLayers on the network analysis layer object.  The last code sample on this page shows it being done (for ArcMap):

Make Service Area Layer—Help | ArcGIS Desktop 

If you're going to add a completely different set of stops or barriers to your sublayers after deleting the existing locations, you actually don't need to do a delete step at all.  When you run Add Locations, just chose the option to clear existing data rather than append.

Highlighted
New Contributor

Thank you Melinda this is really helpful!

Reply
0 Kudos