From ESRI's ArcGIS Spatial Analyst extension Tutorial
Eidan W. Willis
*This lab is still a work in progress.
Introduction
Exercise 1: Preparing for analysis
Exercise 2: Accessing the extension and exploring the data
2.1 Checking out an ArcGIS Spatial Analyst extension license
2.2 Add the Spatial Analyst Toolbar
2.3 Creating a hillshade
2.4 Displaying and exploring the data
2.5 Selecting features on the map
2.6 Identifying features on the map
2.7 Examining a histogram
2.8 Save, save, save!
Exercise 3: Finding a site for a new school
3.1 Creating a new toolbox
3.2 Creating a new model
3.3 Deriving datasets
3.4 Reclassifying datasets
3.5 Weighting and combining datasets
3.6 Selecting the best site
Exercise 4: Finding an alternate access route
4.1 Creating a new model
4.2 Creating the cost dataset
4.3 Raster to Polyline
4.4 Save the map document
Conclusion
In Lab 2 of ENVB 530, we explored the Spatial Analyst extension of ArcMap software through a comprehensive tutorial created by ESRI. ArcGIS and ArcMap offer a wide variety of tools that allow users to perform spatial analyses on their data of choice. These tools are entirely contained within a "no-programming-experience-required" User Interface (though it is certainly still possible to write raw code in ArcGIS). In this tutorial, we explore the ArcMap interface and the functionality of the Spatial Analyst extension using the following exercises to guide our process:
In Exercise 1, we begin unpacking the provided set of data and preparing it for analysis. First, we'll need to make a local copy of our data and create a new geodatabase to store our results.
In Exercise 2, we'll learn how to activate the Spatial Analyst tool, as well as create and explore a hillshade output layer from our initial set of data.
In Exercise 3, we use the Spatial Analyst tool in conjunction with the Model Builder to easily visualize how our analyses build on top of one another to facilitate deeper understandings and more comprehensive results. We create a new toolbox and use it to derive new outputs for Euclidean distance and Slope, reclassify and weigh them according to our building site selection criteria, and use them to locate the optimal building site for the new school.
In Exercise 4, we finish up our project by performing a cost distance analysis to be able to find the least costly route for an alternate access road to the new school site.
1.1 Organizing your data
We begin by downloading our data to our computer and ensuring its accessible to ArcMap via the Catalog. Several steps need to be taken to organize our data before we perform any analyses, including setting up a connection to the data, creating a blank geodatabase titled Scratch.gdb, adding all of the files from the Stowe.gdb to the ArcMap Table of Contents and saving the resulting .mxd file in the Spatial Analyst folder as Site Analysis.mxd. Additionally, we need to enable the Spatial Analyst extension accessed through Customize > Extensions from the main toolbar. Now that we've made the necessary preparations, we can begin looking at the data we've added to the Table of Contents, starting by creating a histogram of the elevation raster file using the Spatial Analyst tool found via Customize > Toolbars > Spatial Analyst. From this histogram, we can see the distribution of our elevation data based on the display resolution of the raster layer. The color of a given pixel represents its elevation value, where lighter pixels are higher in elevation and darker pixels are lower.
Histogram of elevation values based on display resolution in the corresponding raster layer.
We begin Exercise 2 by
navigating to the search tool >> HillShade (Spatial Analyst) tool
input parameters for the HillShade tool, specified Input raster as elevation and Z factor as 0.3048, everything else default
In the Layer Properties >> Symbology tab, change the Value Field to LANDUSE and set symbol colors to match relatively well according to their landuse type.
adding landuse and elevation (from the Stowe.gdb geodatabase) as layers in the table of contents.
In the display tab, change transparency to 30% to be able to see the hillshade behind the landuse layer.
the resulting map
Features selected in the attribute table will show up highlighted in cyan in the map, as is the case above with wetlands.
Clicking on one of the rec_site points using the Identify tool yields information on the features in the surrounding area
A histogram of landuse types in the layer.
we begin by creating a new toolbox in the Spatial Analysis folder named Site Analysis Tools.
Set processing extent and raster analysis to Same as layer elevation.
Unfortunately, an error prevented me from progressing with the model builder. I chose to run each of the tools individually from the ArcToolbox, but then I came back later with ArcMap 10.8 (10.7 didn't work with model builder) and made the model according to the instructions.
a beginning look at the model.
after some modifications
Using the slope tool from the Spatial Analyst Surface toolset with elevation data to create a slope output map of the region
Using the Euclidean Distance tool from the Spatial Analyst Distance Toolset with the rec_sites data to create a map showcasing the shortest distance between two given recreation sites.
The same tool was used with the school data to create a map showcasing the shortest distance between two given schools.
Finalized reclassed slope parameters for slope output
Finalized parameters for reclassification of euclidean distance to recreation sites raster layer
Finalized parameters for reclassification of euclidean distance to schools raster layer
A screenshot of the model after adding the Reclassify tools to each of our products
Reclassified distance to recreation sites
Reclassified slope
Extract optimal sites using the Con tool
Using the Con tool in the Conditional toolset, isolate and extract only the regions that are considered optimal building sites. This is done by attaching the Con tool to the model, selecting the 'Suitable Areas' variable as our input conditional raster value, writing Value = 9 in the expression window, and setting 'Suitable Areas' equal to the input true raster or constant value in the Con tool parameters window. The resulting layer can be seen on top of our previous Suitable Areas layer where the suitability value is equal to 9 (i.e., areas that were determined as the most suitable locations for building a school). These regions are highlighted in cyan in the Optimal areas layer
Refine optimal areas using the Majority Filter tool
We can now use the Majority Filter tool to make a more robust selection criteria for choosing the optimal building area. It can be seen that the sites we just extracted using the Con tool contain many single-pixel regions that are approximately 30 meters in size. These cells alone are much too small to be able to build a school in, so an additional selection criteria can be added that stipulates a minimum acceptable amount of nearest neighbors with the same suitability value of 9. By setting our input raster to the Optimal areas variable, maximizing our Number of neighbors to use to EIGHT, and leaving the Replacement threshold of MAJORITY unchanged, we can now select those regions that must have at least five out of eight connected cells with the same suitability value in order for the present cell to retain its own value. In this way, free-standing pixels or those without the requisite number of same-value nearest neighbors will be filtered out. We can see a zoomed-in look at one of these areas (in gray) on the right; by stacking the unfiltered Optimal areas layer underneath the filtered one, we can see that they don't exactly match up and only those pixels on the fringe of the polygon without the requisite number of neighbors were filtered out.
Selecting the best site
We've now filtered our raster data for regions that would be optimal building site locations based on Slope, proximity to other schools, and proximity to recreation sites. Looking at our Filtered optimal areas layer with the roads layer on top, however, we can see there are some regions highlighted which are far from currently existing road infrastructure. We can now go about filtering these regions further based on this new selection criteria.
Using the Raster to Polygon tool in the Conversions toolbox (see left), we first create a new feature class from the Filtered optimal areas selection layer, ensuring that the Input raster is the Filtered optimal areas raster layer, the Field is Value, changing the Output polygon features parameter path to opt_area, , checking the Simplified polygons box, and accepting the default parameters for all other fields. After running the Raster to Polygon tool and removing all other layers other than those present in the Table of Contents below, your image should look something like the following:
Now let's select those features in our layers of interest based on the roads that intersect. Using the Select Layer by Location tool in the Data Management toolbox, Layers and Table Views category, input the features as follows:
Choose opt_area for Input Layer.
Accept the default for the Relationship parameter, which is INTERSECT.
Select the roads layer from the Selecting Features drop-down menu.
Accept the default parameter for Selection type: NEW_SELECTION.
The resulting selection should similar to the following when zoomed in:
Make another selection criteria using the Select Layer by Attribute tool in the same toolbox with the following input parameters:
Choose opt_area for the Layer Name of Table View parameter.
Choose SUBSET_SELECTION for the Selection type parameter.
Within the Query Builder (button next to the expression section):
Double click Shape_Area to select it as a variable in the expression box.
Click the greater than or equal to button.
Type 40469.
Your selection should now be the largest polygon of the left grouping.
Using the Copy Features tool in the Features toolset of the Data Management toolbox, set the following input parameters to create a new feature class for the final site:
Select opt_area for the Input Features layer.
In the Output Feature Class section, browse to the Stowe.gdb geodatabase file in your Spatial Analyst folder and save a new feature titled final_site.
After doing this, you should have a free-standing polygon of the final site. Be sure to remove the other polygons that were deemed ineligible through the previous steps. Your map should now have the isolated polygon showing and look like what's shown on the right. Make sure to save your changes!!
This section of the lab is currently incomplete
In this lab, we explored the Spatial Analyst extension of ArcMap software through a comprehensive tutorial created by ESRI. We learned how to use the Spatial Analyst extension license to perform an in-depth analysis of a given region through a set of exercises to guide our process. These exercises included:
Exercise 1, where we unpacked the provided set of data and prepared it for analysis.
Exercise 2, where we learned how to activate the Spatial Analyst tool, as well as create and explore a hillshade output layer from our initial set of data.
Exercise 3, where we used the Spatial Analyst tool in conjunction with the Model Builder to easily visualize how our analyses build on top of one another to facilitate deeper understandings and more comprehensive results. Here, we created a new toolbox and used it to locate the optimal building site for a new school.
Exercise 4, where we performed a cost distance analysis to find the least costly route for an alternate access road to the new school site.