Tuesday 19 May 2015

arcpy - How to iterate through layers of an MXD?


I know model builder will not iterate through the layers in an MXD, which is kind of fundamentally stupid if you ask me, but I still need to do exactly that. I am not a strong coder but i understand Python is how to handle this.


I have seen other questions addressing this, but they seem over-my-head in complexity (i have taken an 'intro to python' university course and did well in it, plus did all the ESRI tutorials, still doesn't help understand how this works). I am hoping someone here can post some simple cut-n-paste python I can use to accomplish this.



I need to iterate through the ToC and export each layer as a shapefile to a specific folder. The folder is always the same, but the ToC will change depending on the application, so I have different MXD's for each subset of layers that need to be exported, which is why i want to script/model this as then i can open any MXD and run a tool to get my outputs.




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...