Posts

Showing posts with the label GIS 5103

GIS 5103 - Working with Rasters

Image
 The final module for the GIS Programming course, module 6, focused on working with rasters as the title of this blog post suggests. This module taught students how to list and describe rasters, how to use raster object in geoprocessing, how to use map algebra in operators, and how to work with classes to define raster tool parameters.  By this time in the course, as we are drawing to a close, I have definitely become more comfortable with Python. It is now easier for me to put newly learned functions and methods to use, to identify mistakes and to rectify issues that arise. As such, this week's assignment seemingly gave me very minimal issues in comparison to previous assignments. For the assignment we were tasked with utilizing two rasters, elevation and landcover, to create a final raster that meets certain criteria. The criteria included being a forested area, having a slope between 5 and 20 degrees, and having aspect between 150 and 270 degrees. The following images are t...

GIS 5103 - Working with Geometries

Image
 Module 5 of the GIS Programming course introduced students to working with geometries. Geometries refer to features that are points, lines, polygons or multipart features. We were able to read geometry objects to obtain additional information about them and their properties, we were able to write to the geometry in essence modifying or updating it, and we learned about nested loops which are necessary when working with polylines, polygons and multipart features. The code and functions we learned about take processes that require a long time and provides "shortcuts" making the GIS professional more efficient. This particular module also built on last week's module, requiring us to utilize a search cursor.  The following image is a screenshot of a section of the text file resulting from our assignment.  We were tasked with producing a text file which included a list of the vertices for rivers in a shapefile. Each entry in the list needed to include a feature number, vertex...

GIS 5103 - Exploring and Manipulating Data

Image
 The fourth module of GIS Programming got a little more intense than previous weeks. This week introduced students to: The describe function Listing data Lists and dictionaries Search, update and insert cursors And validating table and field names As usual we got to utilize what we learned during the assignment. The following is a flow chart of my process: If you have seen some of my previous blog posts, you can see that this flow chart is more extensive that previous charts posted. The assignment required students to create a geodatabase, copy shapefiles to the geodatabase using a for loop, create a cursor to find the name, population and feature of all cities labelled county seat, create a dictionary and populate the dictionary. The image below shows my results:  Overall, this assignment was a challenge. I had a few issues arise initially, including but not limited to not being able to overwrite an existing file geodatabase and syntax errors. The biggest lesson for me from t...

GIS 5103 - Geoprocessing

Image
This week's topic is Geoprocessing! After focusing on learning Python for the past two modules, it was nice to see how python is used specifically for GIS and geoprocessing. In the first instance, we got a quick review or crash course (depending on your knowledge base) on utilizing geoprocessing tools, batch processing and model building. While it is possible to utilize a geoprocessing tool to complete one process, batch processing allows you to utilize one tool to process multiple inputs, and model building allows you to utilize many tools to complete a workflow instead of one tool at a time. We then learned how to utilize python script to run a geoprocessing tool or complete a workflow using multiple tools.  For our assignment we were required to add XY coordinates of a hospitals shapefile, create a 1000 meter buffer, and dissolve the buffer into a single feature. Below are my results.   Once the necessary module were added and environment set, I ensured the overwrite o...

GIS5103 - Debugging and Error Handling

Image
 During module 2 of GIS Programming we learned about fixing errors. In particular we were taught of various ways of identifying errors and how to handle them. The first method of identifying errors included simply running the script to see the error presented if the script failed to run. The error presented states the type of error and tells the user which line of the script it can be found on. The second method, referred to a debugging, runs the script line by line allowing the user to pinpoint the issue(s). We also learned how to implement a try-except  statement. A try-except  statement in placed strategically in the script to handle the error, allowing the script to successfully run with the error present. An exception is made for the error.  This week we were tasked with fixing the errors in three scripts. The first script had a few syntax errors or spelling errors. Below is an image of the successful result and an accompanying flow chart.  The second scrip...

GIS 5103 - Python Fundamentals

Image
 Welcome to GIS Programming! This course is introduces students to Python, which is the primary programming language used in GIS. During the first week of this course we got an understanding of the fundamentals of python. This included, but was not limited to, learning basic functions, methods, lingo and running script. For many, including me, this was the first time we had any experience with python, which meant that it was a quite intimidating and a little overwhelming. However, some adjustment to my usual thought process and exploring some additional resources proved to be fruitful.  I was able to successfully create what I believe to be a simple script, identify errors in an existing script and run them to obtain the results in the image below. I've also included three flow charts of the process below.