37

Where can I start to learn ArcPy?

0

2 Answers 2

73

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.

Do not forget that you can right-click any geoprocessing result and click "Copy as Python Snippet" if you just want to get the syntax of a function call, which is especially useful for things like field mappings and code blocks. It is also possible to export ModelBuilder models to Python code, but there is no guarantee that the code exported from a working model will also work in Python, and for all but the simplest models the code that results is often difficult for beginners to debug.

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.

  • What is ArcPy? is the front page to Help on using ArcPy with ArcMap from versions 10.3 - 10.8

enter image description here

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?.

0
13

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.
0

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