Tuesday, June 20, 2017

Module 5 - Geoprocessing in ArcGIS

This week we expanded on the Geoprocessing knowledge which we touched on during the Intro to GIS class. I first created a toolbox in ArcMap, then inside of that toolbox created a model using ModelBuilder.  Using ModelBuilder, I was able to clip my soils.shp to the extent of my basin.shp. From there I selected and erased all soil areas which were not suitable for farming and a shapefile was created with the final result. I liked how by using ModelBuilder, the flow of data can easily be seen as a tool is used each time.  Therefore, we can easily see how we arrive at the end product.  Using ModelBuilder also saves time, as you can run multiple functions at one time once the model is complete.  Below is my model that was built in ModelBuilder

After my model was created, I exported it as a Python script.  This returned three errors which were pretty easy to fix.  The errors were produced because my input files (soil and basin) were not linked to a file path.  The third error was because the output feature class already existed and could not be overwritten, but a simple line of code was able to remedy this.

Finally within my original toolbox that I created, I created a script tool which allowed by python script to be run as a tool.  When my script tool was run, a shape file showing all areas of the basin which are suitable for farming was deposited into my Module 5 Results folder.  A simple map showing this shape file can be found below.
In order to submit my script tool, I zipped together my toolbox and my Scripts folder which contained my python script.  I really enjoyed learning how python and model builder can help expedite our geoprocessing in ArcGIS.

Wednesday, June 14, 2017

Module 4 - Python Debugging and Error Handling

This week's lab focused on finding errors in python scripts and fixing them, thus allowing the script to run successfully.  We used tools such as the check button and the debugger to identify the script errors and learned a little about what each error means.  I found that simply running the code and reading the error message in the interactive window to be the best way to identify errors.  I had a few issues with the debugger, such as the my yellow triangle disappearing and the debugger simply not working occasionally.  I'd like to spend more time figuring out the usefulness of the debugger tool. The lab was divided into three parts with unique instructions for each.  Screenshots with descriptions of my process can be found below.

Part one was a simple script that contained 2 errors.  I identified these errors as syntax errors pretty easily using the check button.  I was able to correct these and move on to the next script.  Script 1 results are found below.
Script #1 Result

Part two was a longer script which contained 8 errors.  This section was very challenging and I was concerned for a while that I wouldn't be able to find all eight errors.  I spent a lot of time trying to use the debugger tool which I didn't find very helpful.  I ran the script without the debugger and identified the errors by the error message in the interactive window.  I really like that the error messages tell you which line the error is on.  I found myself doing quite a bit of guess and checking to figure out how to correct my errors.  Although these were educated guesses, I know I need more practice debugging. Script 2 results are found below.
Script #2 Result

In part 3 we were not asked to fix an error but instead use a try-except statement to "catch" the error and and allow the script to still run even with the error.  Using the try-except statement, I was able to insert a custom sentence for the machine to print when it identified that certain error.  I was able to wrap my head around the concept of a try-except statement after reading a section on them in chapter 11.  The results of this script are seen below.
Script #3 Result

Sunday, June 11, 2017

Participation Assignment # 1

    Our first participation assignment in our GIS Programming class called for us to find an article or paper dealing with GIS in the real world.  I chose the scientific journal titled “Application of GIS in the Wastewater Management” as the article to use for participation assignment # 1.  I found this article using the GIS databases link provided to us, and searched the key word “GIS” in the Environmental Science Collection (ProQuest) database.  I chose this article because a lot of my work at the environmental engineering firm that I work at involves wastewater management.    
    To begin, this journal gave us an overview of what is a GIS.  The author explains that a GIS enables storage, processing, analysis, modelling, and display of spatial data.  The author then goes on to explain that wastewater treatment systems are great for analysis using a GIS because all of the components making up the system such as water supply, drainage basins, and irrigation systems are spatially located.  This paper specifically focused on dealing with sanitary wastewater and the reuse of that water for irrigation purposes.  The first step to using a GIS to analyze wastewater is to create a digital model of the sanitary sewage system.  All components of a sewer system such as hydrants, pipelines, and manholes can be divided into spatial features such as points, lines, and areas.  This is important because before GIS, all the data making up a sewage network was stored on maps of different scale.  There are already two GIS based software for wastewater sewage systems: 1. Bentley Wastewater 2. ProGIS.
The author goes on to explain how GIS is not only important for the monitoring and maintenance of existing systems, but can be even more useful for identifying suitable locations for future wastewater treatment plants and sewage outfalls.  Using spatial analysis in GIS can help pinpoint and visualize an optimal location while taking into consideration environmental factors which are often ignored.  GIS can also be used to select optimal locations for treated wastewater to be reused based on the water quality parameters.  This is done by matching up water parameters from the wastewater to farming fields for example which can tolerate any specific identified parameters in the water.
I found this paper fascinating and it made me realize how GIS can be used to manage our wastewater in an environmentally and ecologically friendly way.

Link to paper:  Application of GIS in the Wastewater Management

Tuesday, June 6, 2017

Module 3 - Python Fundamentals Part 2

This weeks lab was challenging but at the end greatly increased my confidence in the ability to write code.  During this lab we edited a code which had already been written.  The goal of the code was to play a dice rolling game based on players' name length, resulting in a list of 20 random numbers. Using a conditional statement, we then removed one number which we selected from one to ten.  A screen shot of my code results can be seen below.

The first edit that we had to make involved importing a module so that was pretty simple.  The next edit required us to identify and correct two errors that were placed in a for loop.  This step took much longer than anticipated and I wanted to scream due to "wasted" time, however I refrained because I was in a library.  I decided to go back and read through chapter 4 and this gave me some leads on possible errors and I was able to identify them and move on.  Step three involved writing a while loop.  I was able to piece this together with the help of chapter 4 in the book and some good old fashion googling.  Step four, which removes a number from our original list, came pretty intuitively and I made few errors while writing the code for this.  In step five I completed the comments section to fill in basic info like my name, date and a brief description of what the code does.  I really like the fact that you can place comments in python code to help explain what a line of code does.  I can see how that will be really useful in the future.

This lab caused a roller coaster ride of emotions but I'd say it ended on a high note.  I think this was the most informative lab to date and look forward to seeing what python throws at me next.

Wednesday, May 31, 2017

Module 2 - Python Fundamentals Part 1

This weeks lab introduced the basic functions, methods and syntax involved in writing lines of code to create a python script.  The end product of this lab was a python script which when ran with pythonWin, resulted in my last name (Degnan) and the number of letters in my last name multiplied by three (18).  This lab helped me wrap my head around the overall concept of writing lines of code to create a script which can be run to accomplish an end goal.  In this case, each line of code defined a variable, and that variable was used in the subsequent line of code.  My steps are summarized below:

  • Using the variable stringName, I created a string of my full name.
  • I used the split method to separate my three names into a list.
  • Using indexing [-1], I printed my last name.
  • I then used the length function (len) to find the number of letters in my last name.
  • I used a basic math function to multiply the resulting integer by three. 
Below is a screenshot of my script result and a flowchart summarizing my script writing process.  

As you can see above, this script gives my last name and the number of letters in my last name multiplied by three.

Overall I learned a lot from this lab and feel comfortable writing basic script now.  I ran into one problem while running my script but after a bit of debugging I realized I had a capitalization error.  This made me realize the importance of proof reading my code as I type so while it caused quite a bit of frustration, it was a learning experience.

Tuesday, May 23, 2017

Module 1 - Zen of Python

This blog post marks the beginning of my second class at UWF, working towards my GIS Certificate. This semester in "GIS Programming," we're going to learn the basics about the scripting language Python, which is important because ArcGIS uses Python for scripting via ArcPy.  In this first lab we ran a python script titled CreateModuleFolders.py using the interface PythonWin.  This script deposited 12 folders into our S:\GISProgramming folder, each folder containing data, scripts, and results sub-folders for our 12 Modules throughout the semester.  This demonstrated the efficiency of running a python script to save time.  Below is a screen shot of the 12 folders in my S drive.

While completing this first Module, we learned about the "Zen of Python" written by Tim Peters.  It can be accessed by typing "import this" in PythonWin and using 19 sentences,  describes the philosophy of the Python scripting language. I thought it was a cool way of introducing us to GIS Programming.  

Monday, May 1, 2017


Our final focused on the GIS analysis which went into deciding where Florida Power and Light (FPL) should build the Bobwhite-Manatee Transmission line in west central Florida.  This lab really allowed us to see how the use of GIS can help expedite decision making when it comes to large construction projects such as this one. Not only does GIS help expedite the process, we can be confident in the accuracy of the study as well.  We specifically focused on four main objectives when it came to transmission line location decision making. We wanted to help FPL avoid as many environmentally sensitive lands as possible, avoid as many homes as possible, avoid schools and day cares, all while building the line in the most direct path possible to avoid unnecessary costs.  I found that FPL accomplished all these objectives and therefore the transmission line should be approved.  In reality, the project was approved in 2008 and the 230 kV Transmission line is currently keeping the lights on in this little corner of Florida

Our final project was meant to push ourselves to remember all the tools we have learned throughout the course of the semester.  This was challenging at first but I realized organization was key.  After frantically flipping through my old labs trying to remember how to use certain tools such as digitizing homes using the editor tool, I decided to print all my labs out.  I organized them into a binder with tabs so as I needed to recall how to do something, I could save valuable time.  Tools used to complete this final included but was not limited to clipping, buffering, digitizing, overlay, drawing, and editing. It was fulfilling realizing how much I'd learned throughout this first semester and I look forward to the rest of my GIS certification journey!

Powerpoint Link:  http://students.uwf.edu/ccd24/Final_Powerpoint.pptm
Transcript Link:  http://students.uwf.edu/ccd24/Transcript.docx