Thursday, May 28, 2015

Module 2 - Python Fundamentals

This week in Programming we wrote our first Python script. It's a short script but without going through the 23 page practice exercise before trying to write it, I would have been completely lost. I learned a lot about syntax, assigning variables, and had a brief introduction to methods and functions. I know once we delve deeper into scripting for GIS I'm going to get a little confused with the names and uses of all of the tools and functions available. That being said, I am really glad that the Python Window in ArcGIS provides prompts when you start typing in the code and at the same time provides a help window with directions for how to fill in the required objects and arguments. I think those features will be lifesavers for me as this course continues on.

The script I wrote identifies my last name, counts the letters in my last name, and multiplies that number by three. The initial variable I started with was my full name and then I used functions and methods to create new variables and count the letters. The picture below shows the result of running the script.
Result of Last Name Script
One thing I learned this week that I am going to have to be extra careful about is using the right characters. Brackets, parentheses, apostrophes, and quotation marks all have specific purposes and are not always interchangeable.

Monday, May 25, 2015

Lab 1 - Suitability Analysis

This begins the blog section for Application in GIS (GIS5100). Last week was an introduction to the course and a review of everything I should have remembered from last semester. Let's just say GIS work is a lot more complicated with minimal directions but with ArcGIS Help, most things are possible.

The real work started this week with Suitability Analysis. The first challenge was to identify suitable areas for a mountain lion habitat using data provided by the instructor using a Boolean Suitability Model. The elements we used were a land cover raster file, an elevation data raster file, a road vector file, and a river vector file. I identified the suitable habitat areas using a vector method (converting all raster data to vector data) and a raster method (converting all vector data to raster). Both methods reduced all of the data to a basic yes or no option, does the area meet requirements or not? Using the Reclassify Tool in the Spatial Analyst Toolbox all of these yes and no answers were converted to 1's and 0's in the attribute tables for all of the files being analyzed. By the end of the process all I had to do was write one SQL query to sift through all of the data and find the areas that answered yes to every suitability requirement.

Then we took things a step further and rated locations by suitability, not only figuring out what areas were suitable but identifying how suitable they were. The process was very similar to the first part of the lab except in this section all of the data was analyzed in raster form. The difference came with the application of the Weighted Overlay Tool. Using this tool you can sort your data by how important it is, not just if it meets your needs. When assessing the slope of an area everything over 10 degrees slope may meet the suitability requirements but but a slope greater than 16 degrees would be better and a slope greater than 20 degrees would be ideal. You can assign values the data indicating these preferences. Then using the Weighted Overlay tool you can factor in these preferences associated with individual datasets as well the importance of one dataset over another. For example, soil composition may be more important than slope but you also want to consider the preference for different slope values and soil types. For the lab we evaluated five criteria; slope, soil, land cover, and proximity to rivers and roads. The graphic below shows the difference between an equally-weighted analysis and an alternate where slope was deemed the most important factor.
Suitability Analysis for Lab 1

Friday, May 22, 2015

Module 1- An Intro to Python

The summer semester has started and I just took my first look at Python! Python scripting as a concept makes complete sense to me but I have a feeling it is going to be a lot more tricky in practice. We used one script that the instructor provided in the Intro2GIS course last semester and it was easy to see the value in knowing how to use this language so I am excited to work through this course.

For the introduction to programming (for GIS more specifically) we used a Python script to set up the folder structure of our individual student drives on the remote GIS desktop that we use. I knew the tech guys at my last job knew how to do this stuff but I had no idea how to do it myself until now. Our lab walked us through how to use the basic functions of WinPython and then we were provided with a script to use to create our folder structure. Here is a look at the folder structure for everyone in the class --
The Standard Folder Structure for UWF's GISProgramming Course

We also had to write a pseudocode for a fairly simple math function. This step took me back a few years to basic algebra where my instructor regularly reinforced the idea of showing all of your work. I think that is going to be one of the most important things for me to remember as I continue through this programming endeavor, all of the work needs to be written out or the code will not work. I know sometimes I take shortcuts or overlook the simple steps that are always used to solve a problem but missing these little bits could cause big problems, like missing out on a piece of analysis that I was I expecting to be done in ArcGIS. I hope I didn't just jinx myself because I am eager to develop some Python scripting skills!