Wednesday, July 20, 2016

Programming: Module 9

Raster Result
This week's lab I worked with raster files and wrote a script that identifies areas with a certain slope, aspect, and land cover type.  The script for forest land cover with a slope between 5 to 20
degrees and aspect of 150 to 270 degrees.

I imported arcpy, and sent the environment.  I also imported tools from ArcPy Spatial Analyst. The script checks out the spatial extension and makes sure its available.  I also made sure to have the overwrite function enabled.  The script reclassified the forest land cover so it would have a value of 1.  Next the script found the slope of the elevation shapefile.

Then the aspect tool is used to find the aspect of the elevation shapefile.  The script finds the cells with a slope less than 20 and greater than 5.  The script also found the cells with an aspect of 150 to 270 degrees.


Finally the script combines the slope and aspect requirements.  If spatial analyst was not available, the script would print the license is not available.

Below is a flow chart of the script and also a screenshot of the result of the script.

No comments:

Post a Comment