From the course: Learning ArcGIS Python Scripting

Unlock the full course today

Join today to access over 23,400 courses taught by industry experts.

Write a script using list methods and a for-loop

Write a script using list methods and a for-loop - ArcGIS Pro Tutorial

From the course: Learning ArcGIS Python Scripting

Write a script using list methods and a for-loop

- [Instructor] Now I'll show you how to write a script that lists out all the layers in a map and whether or not those layers are visible, whether they're checked on in the map. This will allow us to use the looping constructs we've learned about, as well as one of the list methods in ArcPy. As always, first thing we have to do is import arcpy, and then I'll instantiate the project object. I'm going to create a variable called aprx and I'll set it equal to arcpy.mp.ArcGISProject. We learned earlier, that's how you can make that open connection to a project. Inside the parentheses goes the name of the APRX file with a fully qualified path, right, the whole path and file name. If you want to follow along, you do have this project file in the exercise files. I've provided it as a project package, so you'll have to unpack it, and figure out where the APRX lives in your directory structure, and change it in this directory path here. So once I have the project, then I can get to the map. So…

Contents