AnsweredAssumed Answered

How do I delete a network analyst layer (i.e., Service Area, Closest Facility) using python 3 (ArcGIS Pro)?

Question asked by andrewfclark on Jul 13, 2019
Latest reply on Jul 22, 2019 by andrewfclark



I am building a toolbox using Python 3 in ArcGIS Pro 2.4. It involves a series of network analysis processes, including closest facility and service area. I am using and I am able to create them no problem, but I am having lots of trouble with manipulating them, including: 

  • I cannot select the location where they are stored - they always get placed in the default GDB even though I am trying to put them "in_memory";
  • I cannot name them something meaningful - They always are named ServiceArea1, Service Area2; and 
  • I cannot delete the final layer using python (arcpy.Delete_management) once I am done with it - so every time I rerun the syntax it adds a new file with the wrong name (e.g., ServiceArea2) and my tool crashes. 


Anyone have any suggestion on how to fix this and make it work correctly? I want to be able to create it in a specified location, name it something that is meaningful and then delete the file when it is done.