ArcGIS Pro

Beginner’s guide to Python in ArcGIS Pro, Part 2: How?

This is the second installment in a series of posts for non-programmers hoping to learn Python for ArcGIS Pro. Take a quick look at my first post if you haven’t already. 

In this post, I’ll discuss the types of resources available to help you learn the essentials of Python for ArcGIS Pro. But before we do that, it’s important to think about how you’ll use these resources. Here are two principles to keep in mind.

Cartoon python in toolbox

1. Set a goal

Though using Python for ArcGIS Pro is just a subset of the larger world of Python, it still encompasses a huge amount of functionality, which can be overwhelming. To avoid getting lost in the weeds, you’ll want to set a specific goal to guide your learning. Here are some examples: 

Maybe you’re unsure of your precise goal, but you have a sneaking suspicion that Python will come in handy for you someday. In that case, just pick one that sounds interesting to you – the two first bullets above are great places to start. Or dig up an old GIS project and attempt to automate it with a script.  

2. Build a foundation

Now that you have a goal in mind, you need to scale back your thinking and take GIS out of the equation for a little while. The essentials of Python – and of programming more generally – should be tackled in general terms first. The more effort you put in up front to gain general Python skills, the easier it’ll be to plug these skills into ArcGIS Pro.  You’ll see this in the resources I list below: while some are GIS specific, the first ones I point out are all-purpose Python resources. These do the best job of covering the basics. 

Remember that if you get in too deep, you can always take a step back and practice more of the basics. As you begin to go through your learning resources of choice, focus first on these concepts: 

This is just a start, and not an exhaustive curriculum. For that, I give you the following. 

The resources

If you ask a programmer (or Google) how to learn to code on your own, the answers usually boil down to a few strategies. You’ll probably use a bit of all three to learn Python for ArcGIS Pro, but it’ll be up to you to decide what works and assemble your own best recipe for success. 

Based on various sources and my own experience as a beginner, I’ll break it down: 

Read a book.

Guess how many books have been written on Python? 

can’t say either, but I do know there are a LOT. They come at different price points, and some are even free. You can download eBooks, or check out a hard copy from most libraries. Whatever you pick, I recommend a structured learning resource with hands-on exercises built in.  

Think Python came highly recommended to me, and of the books I’ve tried, it’s my favorite so far. It does a good job of explaining the essentials of programming at the same time as introducing Python, is not too long, and has exercises in each chapter. Plus, it’s free to read online. I’ve also taken the highly scientific approach of combing online listicles like this one and seeing which beginner books appear most frequently. These results indicate that Python Crash Course by Eric Matthes and Learn Python the Hard Way by Zed A. Shaw are two of the best choices.  

When you’re comfortable with the basics of Python, try an ArcGIS-focused Python book. The latest is Python Scripting for ArcGIS Pro by Paul Zandbergen for Esri Press.

Take a course.

Like books, there’s a broad spectrum of courses you can sign up for. These range from college degrees in computer science (completely NOT NECESSARY for our purposes), to self-paced, free apps like SoloLearn. Luckily, in our age of online self-learning, you have plenty of middle-ground options to choose from. Udemy has a course that frequently goes on sale up to 90% off, and Coursera offers certifications through accredited universities.  The Python Tutorial is the most authoritative learning resource you’ll find online, though it assumes the reader has some programming knowledge. 

But we mustn’t forget Esri Training! This is where you’ll learn to employ your new knowledge of Python basics to your GIS work. It’s what we’re all here for. Get started with Python for Everyone and then move on to Python Scripting for Geoprocessing Workflows. There are more advanced options and instructor-led workshops. Just search “Python” in the course catalog. 

Read the Help, try stuff, and keep a positive attitude. 

You don’t need to master Python before you start using it in ArcGIS Pro. Once you have the basics down, make sure you’re in a problem-solving mood and crack open the ArcPy Help. The ArcPy Help is your new best friend. Here, the functions and classes you’ll need to work with your GIS projects are documented in detail and searchable by keyword. The best part? Nearly every page includes a code sample, which you can pull from and adapt for your purposes. Every geoprocessing tool has a code sample on its help page, as well.  

For your general Python questions, the Python Help will be instrumental to your success, too. You can also check out forums like Stack OverflowPython IRC, and Reddit 

Think about this endeavor as a combination of a research project and a puzzle. You’re going to have a goal in mind. You’ll spend a lot of time paging through the Help to find the functions that will help you reach that goal. Then, using these references, you’ll write a script. You’ll debug it. Don’t get discouraged if your script doesn’t run on the first try; even the most experienced programmers spend lots of time debugging their work. When your first script runs successfully, you’ll feel pretty great about yourself: the way you feel when you solve any challenging GIS problem. 

By now, you should have a good idea of how to get started. There are a lot of options, so take your time to scope them out and stick with what feels right for you. For a guided introduction to Pro’s Python window (and to protect the schoolchildren of Redlands, CA from a mass breakout of zoo animals), see my mini-tutorial post.

About the author

I'm a technical writer for ArcGIS Pro who came to Esri after my wildlife biology studies exposed me to the power of GIS. I'm fascinated by how communicating creatively with data connects people to places, and committed to providing ArcGIS Pro users with the information they need to succeed. When I'm not at work, I love to ski, travel, or do anything else that gets me outdoors.

Connect:

Next Article

ArcGIS Monitor: Analysis Elements for Enterprise portal content

Read this article