Seven easy ways to start learning Python and ArcPy
I have some great news: you don’t have to be a programmer to write code! Thanks to languages like Python, coding is now available to the masses, and the GIS world is one of its newest audiences.
The ArcPy site package provides access to the geoprocessing tools found in ArcGIS for Desktop. Using it can be a challenge if you are unfamiliar with Python, but with some basic knowledge, you can start using it to make your ArcGIS work flows faster and easier.
This post is broken up into sections based on different learning styles. You can choose to read, watch, or code your way into the world of Python, and each section will empower you with the knowledge for getting started with ArcPy. Here are some recommended resources I’ve used for teaching myself Python and ArcPy.
Don’t be scared by the title – Learn Python the Hard Way (LPTHW) is probably the most popular online tutorial for learning Python. In fact, many “Pythonistas” at Esri started learning Python with this website! This exercise-oriented guide reinforces its teachings through repetition and practical usage of basic Python functionality, even if you have no prior experience. I recommend completing the first 32 exercises to equip yourself with the knowledge you need.
I recommend this site for those users who are used to a more “textbook” approach to learning. The book is produced by O’Reilly and is now free to the public. The approach is different than LPTHW, and some people may find it to be less fun to learn from, but it’s packed with useful information. The chapters up to, and including, “Files”, will be the most useful for ArcPy users, but reading subsequent chapters will help you understand a little bit about what’s going on “under the hood” in a Python module such as ArcPy.
The videos in this series are perfect for their format. They are concise (each video runs about five minutes), thorough, and show practical coding examples that you can follow along with or practice on your own. In the first 31 videos, this series covers just about all of the concepts you will need for getting started.
Khan Academy has made free education available to everyone for a variety of topics, and their Python course was one of the first “classes” offered. The curriculum is similar to what you can expect from a Computer Science class, so it may seem a little challenging at first. However, if you stick with it, you’ll be thinking like a programmer.
This is an interactive Python course that teaches the basic concepts of Python by having you complete coding exercises. All the work is done online –you don’t even need Python installed on your computer to complete it! The site prompts you to complete small lessons and challenges, and is great for those users who don’t always have a consistent amount of time to contribute to studying. I would recommend completing the first 15 lessons if you want to understand more about Python.
Esri’s training site is the best way to see Python in action, apply it to ArcPy and GIS workflows, and hear some great questions from users like you and I. The courses are designed for users with any level of experience with Python and ArcPy, so you’ll come back to this site time and again to learn new tricks or brush up on your skillset.
This is one of the only educational textbooks out there for learning the basics of ArcPy, and it helped me a lot when I started using ArcPy for the first time. The first four chapters are devoted to learning the ins-and-outs of basic Python functionality, and the rest of the book focuses on specific scripts. You’ll get a cohesive and complete introduction to ArcPy as you work your way through this book.
In addition, this Support Services Blog post talks about learning ArcPy, and very nicely outlines all the resources that are out there. Once you’ve finished reading my blog entry, you can concentrate on the one above!