Wednesday, July 22, 2015

GIS Programming - Module 9 - Working with Rasters

This week's exercise on working with rasters was very useful but also fairly straightforward and easy to understand.  We applied slope, aspect and raster algebra operations that we've learned in earlier GIS courses to Python scripting and learned how to explore, describe and manipulate rasters using Python.

Two rasters were provided: elevation and land cover.  Slope and Aspect rasters were developed from the elevation, and forested land cover was isolated from the land cover classification.  We determined ideal areas based on slope, aspect and forest cover and the result was a final suitability raster.

The final raster is shown below:
The green areas (value =  1) are considered suitable for the purpose of the analysis:
Slope = 5 - 20 °   Aspect = 150 - 270°  Land cover is forested
Boolean AND logic was used in the script:  all parameters must be true to give output value of 1 in the raster.

Figure 1. Final raster showing suitable areas of slope, aspect and landcover (green)
























Below are the results for the script run, consisting of commentary at all stages of the process.

Figure 2.  Interactive Window Results for Script






























Process Summary Notes

Which step did you have the most difficulty with? Describe 1) the problem you were having, and 2) the solution or correct steps to fix it. 

1.      This lab was not too difficult for me because I already had quite a lot of experience with rasters from previous UWF courses and already understood the concept of map algebra. 
2.      Creating the raster objects for max and min slope, max and min object and forested land cover required the most thought, because I’d never done scripting for this task before.  The exercise and assignment instructions helped with this, though. 
3.      Also, I had not worked with the Boolean AND operator much before, but instead had added and multiplied the raster values for suitability and least cost analysis.  It makes sense, though, and wasn’t hard to figure out. 
4.      The main obstacle I had was when I produced my final raster.  It had three colors instead of two, as the assignment example shows.  There were different colors representing 1 and 0, but also white area of NODATA. 
5.      Once I used the Identify tool to see what was what, and read through the lab, ArcGIS Help, and text more, I realized that I needed to remove the NODATA clause in the script of the Reclassify line in the land cover raster. 
6.      I was confused for a while with this, because the reclassed land cover raster has a value of 1 for all forested areas (41, 42, 43) but the other classes retain their original values.  It seemed necessary to assign the other classes to NODATA.
7.      After some further reading, however, I realized that this doesn’t matter, because once the Boolean operation of the 5 parameters is carried out, any value NOT equal to 1, no matter what it is, will result in a value of 0 in the final raster. 
8.      The biggest problem with this script had nothing to do with the raster management but rather with the overwriting of the file geodatabase in repeated runs of the script.  Although I wrote overwrite output, plus uncompressed  and deleted the already-existing file geodatabase in the script, there is still an error which prevents the file geodatabase from being recreated in repeated runs of the script, UNLESS Python is completely closed out between runs. 
9.      I would like to learn how to close down Python from within the script, at the end.  I tried to do this but it didn’t work. 

10.   It is not necessary, however, to delete the .gdb each time from the catalog.

No comments:

Post a Comment