I realize I have not been terribly thorough in giving instructions with the scripts I have posted so far. They have been short and relatively simple, but in order to use them, I think you would have to be familiar with the process of running a Python script from IDLE and/or creating a script tool in ArcMap. I am using ArcGIS 10 at home, but at the office I have ArcGIS 9.3.1 installed, so the scripts and the methods by which I run them are different depending if I am at home or at work. I will try to remember to be specific about which I’m using, and give more details about how to run these scripts or import them to script tools and so forth in the future.
In the meantime, though, here are a few hints–
(1) If you see “import arcpy” near the top, I am using a computer with ArcGIS 10 and Python 2.6. If you see “import arcgisscripting” I am using a computer with ArcGIS 9.3.1 and Python 2.5.
(2) If you see lots of variables hard-coded, meaning things like “elevInput = ‘C:\\GIS\\TEST_FOLDER\\elev_10m'” then I have written the script to run from IDLE. If you see “elevInput = arcpy.GetParameterAsText(0)”, then I have written it to be used as a script tool.
(3) If you are saying, “huh?” or don’t know about scripting but want to learn, then I recommend checking out the following resources:
First, get familiar with ESRI’s online help if you aren’t already. For ArcGIS 10, go to http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html and get familiar with the Geoprocessing Tool Reference (Professional Library > Geoprocessing > Geoprocessing Tool Reference). Also check out the bit on Creating Script Tools (and off of that, Customizing Script Tool Behavior) under Geoprocessing. For 9.3.1 Geoprocessing and Geoprocessing Tool Reference are both on the root at http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?TopicName=welcome. These are extremely helpful as they provide examples and details about the parameters.
Okay, now Python-wise, I recommend Mark Lutz’s book Learning Python (http://www.amazon.com/Learning-Python-Powerful-Object-Oriented-Programming/dp/0596158068/ref=ntt_at_ep_dpt_2). Personally I bought the 3rd Edition because it was cheaper and covers up through 2.6, which is what Arc 10 uses.
Also, through Penn State you can access quite a lot of stuff from an online course for free at https://www.e-education.psu.edu/geog485/. There are other resources worth a look at http://open.ems.psu.edu/courseware, while you’re at it.
And you might as well read through some of Dive Into Python: http://www.diveintopython.net/toc/index.html, and bookmark docs.python.org. Okay, now don’t get overwhelmed– I think it was Lao Tzu who said what has generally been translated to “A journey of a thousand miles begins with a single step.” The journey may seem overwhelming, but you can surely handle a single step. And after that, take another when you are ready. And another. And we’re underway!