Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I would like to learn ArcPy, but I do not know quite where to begin.

Does anyone have any good advice on where I should start to learn ArcPy?

share|improve this question
6  
Do you already know Python? It will make your life much easier if you learn to write Python code without involving arcpy until you have at least some experience with it. I would say half of the "arcpy" questions on this site are from people that just don't know enough Python. –  blah238 Mar 7 '13 at 21:10
7  
See also: What are the best resources for learning GIS programming with Python? I think it's fair to say this question is different enough from that one given the arcpy focus. –  blah238 Mar 7 '13 at 21:43
2  
This question would have no definitive answer though and would just invite a list of answers. Different folks learn differently after all. I think it should be a community wiki. –  R.K. Mar 13 '13 at 3:10

9 Answers 9

I compiled this list a while ago so it may be somewhat out of date. Making it community wiki so anyone can update/correct/add to it. Also see these general tips for new Python programmers in this answer.

Presentations:

ArcGIS Documentation:

Online Books:

Online Courses:

Tutorials:

Official Documentation:

Paper Books:

Paper Books on Python in ArcGIS:

User Communities:

Blogs:

Sample Code:

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

Modules/Frameworks:

share|improve this answer
2  
+1 Very nice collection of information! –  Chad Cooper Mar 7 '13 at 22:28

I would start with these places:

  1. Codecademy offers free online coding lessons, including Python. Use this to get the feel of how python works before working on ArcPy. You'll be glad of having the basics down when you work with ArcPy.
  2. Check out the free Virtual Campus presentation on ArcPy. It's a bit dry, but it will help orient you to how ArcGIS implements Python. After this presentation, you'll have a better idea of what is possible with ArcPy and know what tasks you can realistically accomplish. Edit: It looks like they've got a bona fide Python course as well.
  3. 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.
  4. 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. I also find it educational to try to solve other people's problems.

I hope this helps and have fun with ArcPy!

share|improve this answer
2  
Personally I couldn't stick with Codecademy's Python track, at a certain point the quality of the exercises took a steep dive. The individual course sections are written by different people, so some are better than others and later on I was encountering lots of things like typos in the instructions, quiz answers being evaluated incorrectly by the site, course text that is more concerned with cracking jokes than conveying useful information, and exercises expecting you to know concepts that hadn't been covered yet in the course. –  Dan C Mar 8 '13 at 16:47
    
Yeah, those can be problems. Overall, though, I find their format to be way more approachable than most programming tutorials and guidebooks. I like how they make it easy to break it up into manageable chunks and pick up right where you left off, plus a healthy amount of review thrown in. Another thing I would like to see on Codecademy is more exposure to modules that have wide applicability, like os, sys, and math. –  Jay Guarneri Mar 8 '13 at 16:51
1  
I also found it approachable and it was helpful for as long as I used it, I'd just advise anyone who starts their Python track to be prepared to skip lessons here and there and perhaps at some point take what they've learned and jump ship to another learning resource. –  Dan C Mar 8 '13 at 17:36

All of the above are great resources. I found the best way for me to learn was to come up with something I needed to do, then go out and figure out how to make it work. Your first solution will probably be pretty clunky but just keep working to refine it and you'll pick up things as you go.

share|improve this answer
2  
This is a good point, it's important to have a problem to motivate you to keep learning, otherwise you'll just not put in the time it takes to become proficient. –  blah238 Mar 7 '13 at 21:48

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.
share|improve this answer

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.

share|improve this answer

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.

share|improve this answer
6  
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
4  
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

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.

share|improve this answer
2  
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

Google offers a FREE introduction to Python: https://developers.google.com/edu/python/ and as mentioned above, Python Scripting for ArcGIS provides introduction to Python, but geared towards Arc applications.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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