What are Python Scripts and Why would I want to use them?
Kids react to Apple IIe: https://www.youtube.com/watch?v=PF7EpEnglgk
Using GIS programs, like ArcGIS or Quantum GIS, can get you a long way but eventually you may find yourself doing the same task over and over again on a number of data sets. This can be very tedious and error prone if the task is more than even one or two steps. This is where "Scripting" comes in. Scripts are text-based programs that you can write to do a huge variety of things. They include the ability to do the same task over and over again like process hundreds or even thousands of files. Scripts can also include logic to say look for certain attributes in a set of Shapefiles and copy all the shapes with those attributes to a new file. Scripts can also be written to harvest data from the web, update databases regularly, and so on, the list is endless.
Specifically you can use Python scripts to:
- Run geoprocessing tasks on a large number of files like:
- Buffer a number of shapefiles to the same buffer value
- Convert file formats
- Project a number of files
- Mosaic and tile raster files
- Run periodic tasks using the MS-Windows task scheduler to run the script
- Create new toolbox operations
- Toolbox operations can then be added as tool button
- Create scripts (or toolboxes) to give to others
- Create scripts to harvest data from the Internet
- Create scripts to regularly publish data to the Internet
Python is the most popular programming language within GIS and is rapidly gaining popularity in other fields. Python is relatively easy to learn and very easy to use. Python is an OpenSource project (see www.python.org).
The big advantage of Python is that it can access a large number of "packages". This includes not only ArcGIS but also the OpenSource GIS tools like FWTools (Proj4, GDAL, and OGR). Python can also access the "R" statistical package, packages for charting, higher math functions, 3d graphics, and lots of others.
You'll want to use scripts because they will make your job easier. If Python is you first programming language, it will take a little while to get used to but follow the lessons provided here and you'll be up and running in no time. Then we'll teach you how to tackle just about and problem thrown your way. You'll also learn when you've hit the limits of a computers performance or memory and need to take a different approach.