1

Using arcpy I can make a service area layer in Network Analyst like this:

outSAResultObject = arcpy.na.MakeServiceAreaLayer(inNetworkDataset, outNALayerName,
                              impedanceAttribute, "TRAVEL_FROM", "10",
                              "DETAILED_POLYS", "NO_MERGE",
                              hierarchy = "NO_HIERARCHY")

However, where is this created? in "inNetworkDataset" and the GDB associated, but it's not visible in the GDB or ArcMap. It is there somewhere: when I try to run the script again it says

Failed to execute. Parameters are not valid. ERROR 030036: A layer with this name exists. Failed to execute (MakeServiceAreaLayer).

I change the outNALayerName and it works. I would mainly like to know how to remove or delete old service areas, but am also vaguely curious if it is possible to access them using ArcMap or Catalog

  • 1
    Not sure where it is stored, but have you tried Delete mang. method to delete it, pro.arcgis.com/en/pro-app/tool-reference/data-management/…? – artwork21 Jun 20 '16 at 17:38
  • @artwork21 Thanks for the hint, it works. I should have done a little more experimenting. Question: how did you edit my post? Was I missing something? – woot Jun 20 '16 at 17:55
  • Just some text formatting on your error message. – artwork21 Jun 20 '16 at 19:55
2

As I've noted in my comment, you may use the arcpy delete management method to delete the service area layer.

Permanently deletes data from disk. All types of geographic data supported by ArcGIS, as well as toolboxes and workspaces (folders, geodatabases), can be deleted. If the specified item is a workspace, all contained items are also deleted.

0
inNetworkDataset = C:\\Temp2\\data.gdb\\Network\\Network_ND
outNALayerName = Catchments

arcpy.Delete_management(r'C:\\Temp2\\data.gdb\\Network\\Network_ND\\Catchments')

This deletes it. I wasn't sure if it needed a .lyr, but it seems not. Perhaps there is a way to list the service areas currently in the GDB, as seen in Listing all feature classes in File Geodatabase, including within feature datasets?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.