37

Where can I start to learn ArcPy?

locked by PolyGeo Aug 27 '15 at 9:23

This question’s answers are a collaborative effort. If you see something that can be improved, just edit the answer to improve it! No additional answers can be added here.

Read more about locked posts here.

71

This question has been converted to Community Wiki and wiki locked because it is an example of a question that seeks a list of answers and appears to be popular enough to protect it from closure. It should be treated as a special case and should not be viewed as the type of question that is encouraged on this, or any Stack Exchange site, but if you wish to contribute more content to it then feel free to do so by editing this answer.


Look at posts here and on other websites that use Python scripts and try to deconstruct them and see what techniques the authors are using to accomplish their task. Our self-assembling FAQ on ArcPy is well worth reviewing for this purpose.

You will find it educational to try to solve other people's problems. We have a self-assembling list of unanswered questions on ArcPy to help you find them.

ArcGIS Documentation:

Read the help files!! 90% of ArcPy is just the same as using the GUI tools, only you are starting them using Python. The help files all have example Python code at the bottom.

Online Books:

Online Courses:

Tutorials:

Python Documentation:

Presentations:

Paper Books:

User Communities:

Blogs:

Sample Code:

Tools/Integrated Development Environments (IDEs) - Non-commercial:

Modules/Frameworks:

Also see these general tips for new Python programmers in this answer to Exporting mxds into pdfs using ArcPy?.

  • 1
    Old question, but I'm new to ArcPy and thought I'd add what has helped me recently. This YouTube series was super helpful for me, personally. The videos are short, and I just watched them all in one evening on 2x speed to get a flavor of how ArcPy works (didn't bother with doing any exercises, just watched the videos). [ youtube.com/playlist?list=PLO6KswO64zVu7S4bqQoHWR5516aCUEnda ] – AlexS1 Oct 14 '18 at 16:19
  • I also got this book. It is a decent to good intro and was certainly helpful for me, but definitely lacks depth and advanced topics. Still, I personally thought it was worth it for ~$25 used (wouldn't pay more than ~$35 for it, but that's my opinion). [ amazon.com/ArcPy-ArcGIS-Second-Silas-Toms/dp/1787282511/… ] – AlexS1 Oct 14 '18 at 16:19
14

I highly recommend reading Programming ArcGIS 10.1 with Python Cookbook.

enter image description here

From my own experience, you cannot strictly learn the arcpy site package without eventually bringing in larger concepts from the Python programming language. In fact, I first tried to take the approach you are eluding to, where I began using the arcpy site package to automate processes in ArcGIS. However, I quickly found myself paging through Python documentation looking for better approaches to, for example, manipulate paths such as with os.path.join(). I also found that I had been avoiding incredibly powerful Python libraries such as NumPy and SciPy by accepting the ESRI alternatives. In sum I would recommend the following steps to learn Python fundamentals complimented by the arcpy site package:

  1. First: use an IDE such as PythonWin or PyScripter to do all of your scripting! It takes too many people too long to realize that they can implement and debug scripts outside of the ArcGIS python window.
  2. Perform even the most simple tasks using Python. For example, define a workspace and create a geodatabase programmatically. Don't start out creating complicated scripts.
  3. It's okay to do all of your scripting using arcpy initially--just keep in mind there are better, more efficient methods for many tasks. Always look for a better alternative with pure Python, if necessary.
  4. Find programmatic solutions to inquiries on this site. This will definitely help round out your abilities, as it exposes you to problems outside of your comfort zone.
  5. Finally, once you believe you have a good grasp of Python, take an instructor led course from ESRI such as Introduction to Geoprocessing Scripts Using Python. Yes, these courses are expensive, but they are valuable and will really reinforce what you've already learned. Just do not go into one of these courses without a good grasp of the major concepts.
6

I often train people in using ArcMap and our training course introduces people to Python and arcpy. I try so hard to make people read the Help file! What is it about people not reading the help file, it drives me nuts!

If you open the help file of any geo-processing tool, it always gives a sample of python code using that tool. This is a great way of learning how to interact with the arcpy module in a Python environment.

For a beginner, it's free and built right into the application help file. As you want to do more sophisticated stuff then go for the resources that have been collated on this thread.

  • 3
    This. Yes. There is a lot of documentation in the ArcGIS world. People have put a lot of time into writing that documentation. It's a little confusing to me when people go through the trouble of crafting a long question on the internet that gets a response which is just a link to the documentation when the person could have used a search engine, written a significantly smaller number of words, and gotten to that very same help page. – Jason Scheirer Oct 10 '13 at 14:55
5

The Python for ArcGIS resources page is probably a good start. There are also a variety of books available. If you don't have any python knowledge. Python.org would be a good resource as well.

3

The only thing I would add is build something in model builder and export it to a Python script to give you an idea how the different components fits together.

  • 7
    I would caution against this. There is a lot of cleanup you have to do with this approach (the exporter inserts a lot of cruft, weird variable names, etc., and some things just don't work when exported from ModelBuilder), and I believe the simple act of typing in statements and functions forces you to learn more effectively than letting a tool do it for you. – blah238 Mar 7 '13 at 22:13
  • 6
    An alternative is to right-click a geoprocessing result and click "Copy as Python Snippet" if you just want to get the syntax of a function call (especially useful for things like field mappings). – blah238 Mar 7 '13 at 23:26
  • Yeah, fair point - it's not bad if you're only sticking a couple of operations together (a couple of buffers followed by a clip perhaps) but as you say it gets ugly quickly for bigger models. I do like the idea of copying the gp script as a snippet as well. – om_henners Mar 7 '13 at 23:44
  • Hadn't thought of that for field mappings. I'll have to try that out. – Jay Guarneri Mar 7 '13 at 23:50
  • 1
    +1 this is always a good trick to have, especially if you need to, for example, learn how to integrate reclassify syntax into your script. – Aaron Mar 8 '13 at 0:49
2

ESRI has Python Scripting courses:

And there is a free introduction online seminar in ESRI training website: Using Python in ArcGIS 10

Not the answer you're looking for? Browse other questions tagged or ask your own question.