Python Geoprocessing


Alright everybody, I get a lot of searches everyday for Python geoprocessing related questions.  I would love to add more content about geoprocessing but not sure what it is that all of you would like to learn.  I was going to do a “Geoprocessing tip of the week” but I felt that it would be pretty much the same as looking at the ESRI help docs.

The simplest way is to email me via the about/contact page and I will attempt to answer what I can.  I am also looking at putting on a Python Geoprocessing class(s) here in Phoenix at the DesertPy.org group meetups.  Would there be any interest in a Python Geoprocessing class if I were to have one?  Maybe if there is enough interest we can do a webinar so that those outside of the Phoenix area could also participate.

As always, feel free to drop me a line…

BR

So Why Use Python?


I guess this is a situation of putting the horse after the cart but I realized the other day that I never really listed why I choose Python as my language of choice. Being in the GIS related field I use ESRI ArcView a lot. I found myself performing some tasks repeatedly or rather a series of steps. Maybe I would use one toolbox tool to change a shapefiles projection and then after that I would add the x and y coordinates to the shapefile. I started reading about creating models using ESRI ModelBuilder. No offense to the ModelBuilder but I never really “got it” and therefor never really used it.

What I did find out though is that after I made a Model I could export out the resulting Python code. Hmm, this seemed an interesting way to go. I decided to learn Python programming and more specifically I learned to use it for geoprocessing. I soon learned that ALL of the geoprocessing tools and all of the ArcToolBox tools had an example of the Python code for them. I won’t say that it was as easy and cut-and-paste but using Python for geoprocessing just made sense to me.

I was asked the other day how to choose which language to learn if somebody is interested in learning a programming language. I think that most programmers will use the language that they first learn provided that it serves their needs. That isn’t to say that all programmers will just learn one language or use just one language. I recently started to look at creating web applications and I saw that there is Django which is written in Python to do such a thing. I really struggled with getting Django installed on my Win7 machine!! I know a lot of people that love Ruby on Rails so I started to look at that. I learned enough Ruby to get by and started doing quite a few tutorials creating web applications in Rails.

That sense of failure with the installation of Django just kept bugging me. I recently refurbished a pc from my daughter that didn’t have a hard drive. After buying a new hard drive I decided to go Linux. I installed the new Ubuntu 10.10 and lo and behold, installing Django was a piece of cake. I am now working on the Django tutorials. I will probably add a new section about Django as I go along.

The purpose of all of this is that I now am familiar with Ruby on Rails and that is making it easier for me to learn Django and to improve on my Python. I think I will stick with Django as there is a GeoDjango which is right up my alley. You might need to try out a language or two to decide which the right one for you is. Do some research on the different languages and you will see that there are some that are very similar and others that are very specific. Find the one that suites your needs and have fun programming.