From the course: Learning ArcGIS Python Scripting
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
(Locked)
Working with lists6m 18s
-
(Locked)
List methods and functions8m 48s
-
(Locked)
Use loops to work with lists7m 50s
-
(Locked)
Write a script using list methods and a for-loop3m 39s
-
(Locked)
Nested loops8m 16s
-
(Locked)
Conditional statements7m 35s
-
(Locked)
Write a script using ArcGIS API10m 31s
-
(Locked)
Getting to the properties of GIS data with Describe3m 28s
-
(Locked)
Challenge: Properties of layers37s
-
(Locked)
Solution: Properties of layers3m 4s
-
(Locked)
-
-
-
-