Posts

GIS 5103 -- Lab 6: Geoprocessing using Python

Image
This week we learned how to run basic geoprocessing tools within Python.

The tasks were to:
Assign XY Coordinates to the hospitals.shp
Create a 1000 Meter buffer around the hospitals
Dissolve the buffers

Below is my processing flowchart:

This shows the flow of the process I used to develop my script, which started with the regular hospitals shapefile, added the XY coordinates, used that shapefile to create a buffer, and then used that shapefile to dissolve the buffers.
Below is the results from Python after creating the script and running it.

I had to edit the code a couple of times as at first I forgot to add the buffer distance, as well as got tripped up with case sensitivity in some of the coding. 
To assist me in this lab, I used the interactive python window within ArcMap.  This gave me real-time help on what parameters I needed to include as well as the order to include them in.  I thought this was easier than using the help website for arcpy.
To make this script more flexible, …

GIS 5100 -- Lab 5: Spatial Accessibility Analysis

Image
This week we learned about using ArcGIS for spatial accessibility analysis and modelling.  We used the network analyst extension extensively for this lab.

The analysis started off with using the ArcGIS desktop help guide book for the network analyst tool where we learned how to:
1) Create a network dataset from an existing spatial dataset
2) Find a route within a network dataset from specified locations.  This required the use of creating a new route on the network analyst toolbar.
3) Find the quickest route from service providers to client locations within a network dataset.
4) Calculate service area polygons within a network dataset.  This required the use of creating a new service area on the network analyst toolbar.

Part B of the lab required spatial accessibility using proximity based measures and not using the network analyst toolbar.  For this, we spatially joined data to find the distance from each county to the nearest hospital, and then created a Cumulative Distribution Func…

GIS 5103 - Module 5: Geoprocessing

Image
This week we learned how to simplify basic geoprocessing tools within ArcMap with batch processing, model builder, as well as with python.

The basic flow of steps required:
1) Creating a toolbox
2) Creating a model to run as a tool
3) Set the model parameters
4) Export the model as a script
5) Update the script so it can run as a standalone script
6) Create a script to run as a tool.

Below is a screenshot of the model I created to run the following steps:
1) Clip soils shapefile to the basins shapefile
2) Select from the soils shapefile those labelled "Not Prime Farmland"
3) Erase these selected features from the basins shapefile.


This model also shows the flow of the script that was exported from the model.  The two model parameters, soils and basins shapefiles were clipped and an output was defined as soilsClip.shp. Soils labelled as not prime farmland were then selected from the output and then erased from the basins shapefile to create the final output.

Below is the fina…

GIS 5100: Lab 5 -- Visibility Analysis

Image
This lab was all about conducting visibility and line of sight analysis as well as comparing and contrasting between the two.
Part A of the lab consisted of using the Spatial Analyst Extension to conduct viewshed analysis.  This required the viewshedtool, in which we determined which areas can and cannot be seen from potential tower locations. We then explored the difference from this to using the observer points tool to see more detailed information about which summit can be viewed from where.

Part B of the lab used a more detailed visibility analysis from part A where we located areas of Yellowstone National Park that can be seen from the roads.

Part C we examined visibility at the finish line of the Boston Marathon by examining the viewshed from cameras at the site, and then creating two additional cameras for maximum coverage. For this part we used the 3D Analyst Extension and the LASDataset toolbar for LiDAR data in which we then created a raster dataset from this LiDAR data.  We…

GIS 5013 - Peer Review #1

In the article by Jisheng Xia and Pinliang Dong titled “A GIS add-in for automated measurement ofsand dune migration using LiDAR-derived multitemporal and high-resolutiondigital elevation models”, the development of an add-in tool bar for ArcGIS using Python was created to automatically detect, measure, and store dune migration direction and rate at random point locations.  The model was then tested out on White Sands National Monument in New Mexico. The introduction effectively discusses the importance of having a tool that will automatically conduct dune studies. The article states that the previous methods (before the development of the tool bar) involved remote sensing and LiDAR, however the interpretation was visual and the measurements had to be done manually (which are subjective based on the experience and judgement of the operator). For sand dunes that are constantly changing and are an important part of our landscapes, it is important to have an automated process as errors ar…

GIS 5100 -- Lab 3: Watershed Analysis

Image
This week we learned using ArcGIS for watershed analysis.  This required extensive use of the hydrology toolset in the spatial analyst extension.  Overall, the lab was enjoyable and informative as we learned the functions of many different tools:

Hydrology/Fill: fill sinks within the DEM.Math/Minus: To effectively show where the sinks were locatedSurface/Cut&Fill: To determine the surface area and volume of the sinks to investigate the nature and whether sinks were natural or an error within the dataHydrology/Sink Tool: To identify the sink locations and cell countsHydrology/Flow Direction: To calculate the flow direction of streams using the DEM.Hydrology/Flow Accumulation: To calculate the number of upstream cells that flow into each cell.  This is based on flow direction. Helps identify watershed boundariesConditional/Con: To define a threshold for what is considered a stream.Hydrology/Streams to Feature: To convert created streams raster into a polyline featureclass.Hydrology/S…

Week 4: GIS 5102 Debugging and Error Handling

Image
This week was an extremely useful week in going over debugging and error handling.

For an overview, we learned about the 3 different types of errors we will encounter (probably every time) while using python:

Syntax Errors: problems with spelling, punctuation, and indentation.  Solved by using the check tool in python.Exceptions: Errors that happen while script is running. These are also known as events that are not expected to happen. Solved by "catching" the "thrown" exception.Exception Errors This weeks assignment consisted of finding errors in scripts and fixing them, as well as effectively writing a try-except statement for a script to successfully run with an error.
The first script, basic editing of the script, actually took the longest for me probably because using the debugger was a little confusing, and understanding the error message took a bit of time. Below is the output from my first script.
Using a shapefile, the script printed out the names of the fi…