Friday, June 19, 2020

Working with Rasters

To compliment the previous module where we had vector data, this module is with raster data.  This was an optional assignment but I decided to do it since I thought it would be useful to know how arcpy can operate on rasters.

The assignment was to create a raster that identifies an area of a map that fits all the following criteria: forested landcover, slope between 5 degrees and 20 degrees, aspect between 150 degrees and 270 degrees.  This sort of output would be useful in identifying things like where a particular endangered species of bird might nest and could be used to restricting construction or mining activities.

After importing the appropriate modules and setting up the environment, the first thing to do was to make sure that the spatial analysis extension was available.  The spatial analysis extension is a separately licensed feature and the number an institution has available (if any) is dependent on how many licenses they have and how many are currently in use.  I used a simple if/else statement to check this.  If one is available the program checks it, preforms the desired functions, then checks it back in at the end so others can use it.

The next step is to reassign the various forested landcover values all to the same value then reclassify those values.  I also then extracted by attributes on this raster so that only those with the assigned value existed in the new raster.  The creates a raster with only the appropriately forested areas.

Then I took the elevation raster and assigned it to a variable using the raster function.  I used this variable to create the slope and aspect raster using spatial analysis's slope and aspect functions.  I made sure that the slope function was set to degrees since that's what we would be measuring in for a later step.

I used map algebra to restrict the rasters created in the previous step.  Four temporary rasters where made: where the slope is greater than 5 degrees, where the slope is less than 20 degrees, where the aspect is greater than 150 degrees, and where the aspect is less than 270 degrees.  Both of the slope and aspect layers where then combined with the "&" to create a new raster with all of the restrictions.  I then combined that raster with the extracted landcover values raster for the final project.  Up to this point, all the created rasters have been temporary.  Since this is the final raster that I want, I made sure to save it with the .save method.

The green shows the suitable land that fits all the criteria.

No comments:

Post a Comment