From the course: Learning ArcGIS Python Scripting

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Solution: Properties of layers

Solution: Properties of layers - ArcGIS Pro Tutorial

From the course: Learning ArcGIS Python Scripting

Solution: Properties of layers

(upbeat music) - [Instructor] Okay, how was that? Hopefully it wasn't too hard for you. It brings in a lot of the things that we've learned so far in the course. Let me show you how I did it. But your code could look different from mine, and that's totally fine. As we've talked about before, there are lots of ways to accomplish things with code, but here's what I did. I imported ArcPy, then I created my project object. I do that with aprx equal ArcPy.mp.ArcGISProject, and I'm using the current keyword, again, for the current project. We've done this many times in the course. It's such a common thing. You'll probably want to have this code somewhere in a little text file that you can just paste in whenever you need it. Next, I'll instantiate the map object. I'll do that with listMaps. I'll search for just the Baytown map, and I'll pull off the first one in case there happened to be two named Baytown in the project, which there's not in our project. Next, I'll create the list of layers…

Contents