I would like to write a looping script which solves an x minute catchment in Network Analyst and then exports it to a shapefile. I am trying to get one iteration to work at first and following example #3 ArcGIS help file:
It's possible the export solution as a group .lyr file (layer_object.saveACopy(output_layer_file)) but I can't understand how to grab one of the children of the group lyr (polygons) and export it to polygons. Layers are often items without attributes, but these produced by NA do have them and are easy to export in ArcMap (right click=> export). In arcpy, CopyFeatures and FeatureLayer do not work seem to work grouped layers.
I have tried
for lyr in ListLayers(layer):
but get the error
'str' object has no attribute '_arc_object'
Hello, William. You're on the right track, but your syntax isn't quite right. You need to use listLayers more like this:
Check out the code sample on this page for something closer to what you're trying to do: Make Service Area Analysis Layer—ArcGIS Pro | ArcGIS for Desktop
Hi Melinda --
Thanks for the quick reply. I am looking at it again today and I still get the error:
'Layer' object has no attribute 'listLayers'
But I've also just realized that the Pro help documentation and ArcMap are not interchangable -- the use of arcpy is not the same. In ArcMap you need to pass a map document into listlayers. So I will try again with the right documentation
the arcpy documentation for NA for arcmap begins here
and code examples are contained with eg.
GetSolverProperties—Help | ArcGIS for Desktop which references the sublayers issue