{"id":2316,"date":"2026-09-25T13:16:53","date_gmt":"2026-09-25T13:16:53","guid":{"rendered":"https:\/\/commons.mtholyoke.edu\/emarcano\/?page_id=2316"},"modified":"2026-09-29T14:36:15","modified_gmt":"2026-09-29T14:36:15","slug":"ex3-processing","status":"publish","type":"page","link":"https:\/\/commons.mtholyoke.edu\/emarcano\/mhcgis\/geog323\/ex3-processing\/","title":{"rendered":"Exercise 3 &#8211; Processing and cost surface"},"content":{"rendered":"\n<h2 id=\"top\" class=\"wp-block-heading\">Raster processing and cost surface <strong>analysis<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Contents<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"#part1\"><strong>Part 1:<\/strong> <strong>&nbsp;Resampling and combination of rasters<\/strong><\/a>\n<ul class=\"wp-block-list\">\n<li><strong>Objective:<\/strong> To merge two DEMS with different resolutions<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong><a href=\"#part2\">Part 2: Filtering Rasters<\/a><\/strong>\n<ul class=\"wp-block-list\">\n<li><strong>Objective<\/strong>: To correct errors in the production of a DEM through the use of filters<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong><a href=\"#part3\">Part 3: Cost Surface<\/a><\/strong>\n<ul class=\"wp-block-list\">\n<li><strong>Objective<\/strong>: &nbsp;To create a cost surface for locating optimal places for construction.<strong><\/strong><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-text-color has-black-color has-alpha-channel-opacity has-black-background-color has-background is-style-wide\" \/>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/commons.mtholyoke.edu\/emarcano\/geog323\">Return to Geog 323 page<\/a><\/p>\n\n\n\n<hr class=\"wp-block-separator has-text-color has-black-color has-alpha-channel-opacity has-black-background-color has-background is-style-wide\" \/>\n\n\n\n<h2 id=\"part1\" class=\"wp-block-heading\">Part 1: <strong>Resampling and combination of rasters<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><em><em>Adapted from <\/em><a href=\"https:\/\/www.gisfundamentals.org\/\" target=\"_blank\" rel=\"noopener\"><em>Bolstad &amp; <\/em>Manson &#8211; Resources<\/a><\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"> We often obtain DEM data with various errors, a cell size different that we wish to have, or at different resolutions for different parts of our study areas. We use raster operations to improve our DEM data.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this part, we will combine data of two different resolutions into a mosaic. We often have data from various sources. For example, DEMs at 30m and 10m are appropriate to represent the United States in its entirety, while we use DEMs with a 3m resolution for smaller areas and projects needing finer resolutions.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"> Task 1 &#8211; Study the data<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Our first task will be combining the <em>valley3<\/em> (3-meter cell size) and <em>valley9<\/em> (9-meter cell size) DEMs. We want to use the higher resolution data where it has been collected and use the lower resolution data elsewhere.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This data is from a section around the flood plain of Root river, Minnesotta.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Create a new project and add both the <em>valley3<\/em> and <em>valley9<\/em> DEMs to an empty Map Frame.<\/li>\n\n\n\n<li>Study these 2 DEMs (use a suitable elevation palette) and observed the differences in resolutions. Verify cell sizes for both of them<\/li>\n\n\n\n<li>Calculate Hillshade for both data sets: <strong>Spatial Analyst Tools<\/strong> <strong>&gt; Surface<\/strong> <strong>&gt;<\/strong> <strong>Hillshade.<\/strong> \n<ul class=\"wp-block-list\">\n<li>Use the default settings for azimuth\/altitude and check <strong>Model shadows<\/strong>)<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Inspect these hillshades and note the enhanced detail with the 3m DEM. Note in particular the greater definition of the small streams and stream banks.<\/p>\n\n\n\n<ol start=\"4\" class=\"wp-block-list\">\n<li>Remove, or turn off, the two hillshades from the data view to reduce clutter, they were only used for visualization. We can use the raster calculator to join these two data sets.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">We want to use the detailed <em>valley3<\/em> data where we have it, and the coarser <em>valley9<\/em> data everywhere else.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h3 class=\"wp-block-heading\">Task 2 &#8211; Resampling<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To avoid unforeseen results, we should first convert our data sets to a common resolution, in this case, resampling the 9 meter data down to the 3 meter cell size. This does not make the 9 meter data better but it allows us to combine them with the 3 meter data. (this is contrary to what I told you in class, but heck, let\u2019s do it anyway)<\/p>\n\n\n\n<ol start=\"5\" class=\"wp-block-list\">\n<li>Let\u2019s Resample: <strong>Data Management Tools<\/strong> <strong>&gt; Raster<\/strong> <strong>&gt; <\/strong> <strong>Raster Processing<\/strong> <strong>&gt; <\/strong> <strong>Resample<\/strong>\n<ol style=\"list-style-type:lower-alpha\" class=\"wp-block-list\">\n<li>Input Raster: <em>valley9<\/em><\/li>\n\n\n\n<li>Output Raster: <em>valley9to3<\/em><\/li>\n\n\n\n<li>Output Cell Size: same as <em>valley3<\/em> (<strong>X = 3&nbsp; Y = 3<\/strong>)<\/li>\n\n\n\n<li>Resampling Technique: <strong>Bilinear<\/strong> (click the blue \u201ci\u201d next to Resampling Technique to learn about these methods)<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n\n\n\n<ol start=\"6\" class=\"wp-block-list\">\n<li>After the resampling, examine the <em>valley9to_3<\/em> dataset and verify that it has a 3 meter resolution.<\/li>\n<\/ol>\n\n\n\n<p class=\"has-background wp-block-paragraph\" style=\"background-color:#7bdcb5\"><em>Question 1 &#8211; What are the number of rows and columns for both valley 9 and valley9to3<\/em>?<br>valley9: rows_________  columns ___________<br>valley9to3: rows_________  columns ___________<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h3 class=\"wp-block-heading\">Task 3 \u2013 Combining rasters<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">We can now combine the two data sets.&nbsp; There are many ways to combine data, but one way is with two raster functions: <strong>IsNull<\/strong> and <strong>Con<\/strong>. These functions compare every cell.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>IsNull <\/strong>checks if a raster cell at a given location is \u2018Null\u2019. <strong>IsNull <\/strong>will return \u2018True\u2019 if the value is Null and \u2018False\u2019 if the cell has a value.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The Con function takes three values: 1- a true\/false test; 2-  the value to assign to an output if the test is true; and 3- the value to assign if the test is false.<\/p>\n\n\n\n<ol start=\"7\" class=\"wp-block-list\">\n<li>Using the Raster calculator <strong>Spatial Analyst Tools<\/strong> <strong>&gt; Map Algebra<\/strong> <strong>&gt; Raster Calculator<\/strong><\/li>\n<\/ol>\n\n\n\n<p class=\"has-background wp-block-paragraph\" style=\"background-color:#8ed1fc\"><strong>NOTE<\/strong>: Be careful to type the following expression as given because the operators are case sensitive (e.g., \u201ccon\u201d is different from \u201cCon\u201d). The Raster Calculator is a rather rigid parser. It is easy to add or remove extra spaces and other minor syntax errors (like commas!) that will keep your expression from executing. Try to pick the operators and data from the Tools or Raster windows (when possible) and enter data via the keyboard only when necessary.<br><br>Don&#8217;t give up if you get an error, keep trying, checking on spaces and commas. <\/p>\n\n\n\n<ol style=\"list-style-type:lower-alpha\" class=\"wp-block-list\">\n<li>Input Function: <strong>Con( IsNull(&#8220;valley3&#8221;), &#8220;valley9to3&#8221;, &#8220;valley3&#8221;)<\/strong> &nbsp;(Don\u2019t forget the commas!)<\/li>\n\n\n\n<li>Output raster: <em>combinedDEM<\/em><\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">This function first tests if the cell of <em>valley3<\/em> is Null. This is true everywhere in our study area outside the data region of <em>valley3<\/em>. When the value is Null, the con function assigns the value found in <em>Valley9to3<\/em> to the cell in the output dataset. When the value is not Null, the con function assigns the value found in <em>valley3<\/em>.<\/p>\n\n\n\n<ol start=\"8\" class=\"wp-block-list\">\n<li>Examine <em>combinedDEM<\/em> raster. Compute and inspect its hillshade (choose a suitable output name) and verify that it has the higher detail contributed by <em>valley3<\/em>.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Now you\u2019ll make one nice layout:<\/p>\n\n\n\n<ol start=\"9\" class=\"wp-block-list\">\n<li>Zoom to the extent of the DEM<\/li>\n\n\n\n<li>Choose a suitable \u201celevation\u201d palette for <em>combinedDEM<\/em>  \n<ol style=\"list-style-type:lower-alpha\" class=\"wp-block-list\">\n<li>Symbology: &#8220;Stretch&#8221; <\/li>\n\n\n\n<li>Stretch Type: Standard Deviation <\/li>\n\n\n\n<li>Number of standard deviations 1.5)<\/li>\n<\/ol>\n<\/li>\n\n\n\n<li>Add the hillshade you made in #8, making it semi-transparent (50-60%) over the <em><em>combinedDEM<\/em><\/em> elevation data.<\/li>\n\n\n\n<li>Create a complete Layout\n<ol style=\"list-style-type:lower-alpha\" class=\"wp-block-list\">\n<li>add a reasonable title\/description (<em>e.g. Combined DEM &#8211; flood plain of Root river, Minnesotta<\/em>)<\/li>\n\n\n\n<li>your name,<\/li>\n\n\n\n<li>legend,<\/li>\n\n\n\n<li>north arrow,<\/li>\n\n\n\n<li>scale bar,<\/li>\n\n\n\n<li><strong>and grid.<\/strong><\/li>\n<\/ol>\n<\/li>\n\n\n\n<li>Export the map as a .pdf and upload to Canvas.<\/li>\n<\/ol>\n\n\n\n<p class=\"has-background wp-block-paragraph\" style=\"background-color:#7bdcb5\"><em>Question 2. U<\/em><em>pload your layout to Canvas as PDF. Remember to name your file with your name (e.g. ex3_q2_yourname)<\/em><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-default\" \/>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"#top\">Return to Top of page<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/commons.mtholyoke.edu\/emarcano\/geog323\">Return to Geog 323 page<\/a><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h2 id=\"part2\" class=\"wp-block-heading\">Part 2 \u2013 <strong>Filtering Rasters<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><em>A<em>dapted from <\/em><a href=\"https:\/\/www.gisfundamentals.org\/\" target=\"_blank\" rel=\"noopener\"><em>Bolstad &amp; <\/em>Manson &#8211; Resources<\/a><\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now we\u2019ll look at another way to fix DEMs with errors. We\u2019ll now introduce \u201cfiltering\u201d as a tool to fix \u201cnoisy\u201d data. This is often used with interpolated surfaces, particularly LiDAR data, and similar tools are used near edges for mosaicked DEMs and other continuous surfaces.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Task 1 &#8211; <strong>Detecting errors in DEM<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Add a new empty Map Frame to your project or start a new project.<\/li>\n\n\n\n<li>Load the DEM dataset, <em>Shasta<\/em>, and calculate a hillshade surface for this.\n<ol style=\"list-style-type:lower-alpha\" class=\"wp-block-list\">\n<li>Output <em>Shasta_Hillshade<\/em><\/li>\n\n\n\n<li>Leave the Azimuth as is,<\/li>\n\n\n\n<li>set the Altitude to 25, and<\/li>\n\n\n\n<li>check the Model Shadows box.<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"alignright size-full is-resized\"><a href=\"https:\/\/commons.mtholyoke.edu\/emarcano\/wp-content\/uploads\/sites\/965\/2026\/09\/strange_spots.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"627\" height=\"366\" src=\"https:\/\/commons.mtholyoke.edu\/emarcano\/wp-content\/uploads\/sites\/965\/2026\/09\/strange_spots.jpg\" alt=\"\" class=\"wp-image-2339\" style=\"width:296px;height:auto\" srcset=\"https:\/\/commons.mtholyoke.edu\/emarcano\/wp-content\/uploads\/sites\/965\/2026\/09\/strange_spots.jpg 627w, https:\/\/commons.mtholyoke.edu\/emarcano\/wp-content\/uploads\/sites\/965\/2026\/09\/strange_spots-300x175.jpg 300w\" sizes=\"auto, (max-width: 627px) 100vw, 627px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">Inspect (zoom in\/out\/pan) the output hillshaded layer and notice some odd details. There are data \u201cspikes\u201d that look like white squares with a thin shadow to the southeast. There are also \u201cpits\u201d that look like darker squares with a white \u201cedge\u201d on the southeast. (see figure).<\/p>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li>Repeat the hillshading and this time don\u2019t tick the &#8220;Model shadows&#8221; box and compare the results, specially around those strange places (this is just for you to understand what that box does)<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">These are artifacts of the data generation and\/or hiccups of the data collection process. How do we remove these issues? We can use a neighborhood to identify and get rid of these speckles.<\/p>\n\n\n\n<ol start=\"4\" class=\"wp-block-list\">\n<li>Apply a low-pass filter to the <em>Shasta<\/em> DEM (not the Hillshade) <strong>Spatial Analyst Tools<\/strong> <strong>&gt; Neighborhood <strong>&gt; <\/strong>Filter<\/strong>\n<ol style=\"list-style-type:lower-alpha\" class=\"wp-block-list\">\n<li>Input raster: <em>Shasta<\/em> (NOT the hillshade!)<\/li>\n\n\n\n<li>Output raster: <em>Shasta_low<\/em><\/li>\n\n\n\n<li>Filter type: Low pass (click the blue \u201ci\u201d to learn about this)<\/li>\n\n\n\n<li>Leave Ignore NoData in calculations checked and <strong>Run<\/strong> the filter.<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n\n\n\n<p class=\"has-background wp-block-paragraph\" style=\"background-color:#8ed1fc\"><strong>Note:<\/strong> Low pass is the same as passing a 3&#215;3 neighborhood statistics with the \u201cMean\u201d function.<\/p>\n\n\n\n<ol start=\"5\" class=\"wp-block-list\">\n<li>Calculate a hillshade for this new layer <strong>using the default parameters and do not Model shadows<\/strong>.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Inspect the output, looking at the areas that have previously had spikes and pits (see below). The \u2018after\u2019 image shows a reduction in the severity of spikes and pits, although they are still visible.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We could stop here and just accept the filtered data layer. But if we look carefully at the filtered and unfiltered hillshade, we see there is cost for filtering. We lose some of the fine detail, apparent in the image of the unfiltered hillshade compared to the filtered hillshade.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We\u2019d like to keep both fine detail and remove errors. We can do that!<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h3 class=\"wp-block-heading\">Task 2 &#8211; Further refinement<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">First, we will subtract the filtered DEM layer from the original <em>Shasta<\/em> layer. <strong>Remember<\/strong> <strong>to not accidentally use a hillshade layer<\/strong> (hillshades are used for visual reference and seldom for analysis):<\/p>\n\n\n\n<ol start=\"6\" class=\"wp-block-list\">\n<li>Go to Raster Calculator\n<ol style=\"list-style-type:lower-alpha\" class=\"wp-block-list\">\n<li>Use the formula: <strong>&#8220;shasta&#8221; &#8211; &#8220;shasta_low&#8221;<\/strong> in the Raster Calculator (<em>shasta<\/em> minus <em>shasta_low)<\/em><\/li>\n\n\n\n<li>Name the output <em>Difference<\/em>. Then <strong>Run<\/strong>.<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"alignright size-full\"><a href=\"https:\/\/commons.mtholyoke.edu\/emarcano\/wp-content\/uploads\/sites\/965\/2026\/09\/hillshade2.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"219\" height=\"205\" src=\"https:\/\/commons.mtholyoke.edu\/emarcano\/wp-content\/uploads\/sites\/965\/2026\/09\/hillshade2.jpg\" alt=\"hillshade errors\" class=\"wp-image-2327\" \/><\/a><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">A zoomed-in version of <em>Difference<\/em> demonstrates the largest differences around the spikes and pits, seen as squares of contrasting shades (see figure). Click around the raster to verify that most of the area contains very little difference (around 0) except at those black &amp; white pixels where the differences are significantly higher.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We can then replace the cells where the difference is \u2018large\u2019 and leave the rest unchanged. Large is a relative term, but after a few trials and looking at the difference histogram, a threshold of about 15 works well.<\/p>\n\n\n\n<p class=\"has-background wp-block-paragraph\" style=\"background-color:#8ed1fc\"><strong>Note<\/strong>: Right click on <em>Difference<\/em> in the CP and choose Create Chart\\Histogram, select Band_1 as Variables. Notice the Average value (most values are near 0). Close the Chart properties window and look at the histogram, use the magnifying glass to zoom in and notice that values different from 0 are within +-10.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We want to replace the value in the <em>shasta<\/em> image when the difference compared to the filtered <em>Shasta_lo<\/em> image is greater than 15 meters. Otherwise, we do not change the <em>shasta<\/em> value. This means only messy data is replaced and good data is left alone with no degradation from the filter.<\/p>\n\n\n\n<ol start=\"7\" class=\"wp-block-list\">\n<li>Go to the raster calculator and apply the following function:<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Con( Abs(&#8220;Difference&#8221;) &gt; 15 ,&#8221;shasta_low&#8221;, &#8220;shasta&#8221;)<\/strong><\/p>\n\n\n\n<ol style=\"list-style-type:lower-alpha\" class=\"wp-block-list\">\n<li>Name the output <em>smoothed.<\/em><\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">This equation checks if the absolute value of the difference is greater than 15, we write the filtered <em>Shasta_low<\/em> value to the output, otherwise, we write the original <em>shasta<\/em> value.<\/p>\n\n\n\n<p class=\"has-background wp-block-paragraph\" style=\"background-color:#7bdcb5\"><em>Question 3. What are the lowest\/highest values of elevation in &#8220;Smoothed&#8221;?  <\/em><\/p>\n\n\n\n<p class=\"has-background wp-block-paragraph\" style=\"background-color:#8ed1fc\"><strong>Just for fun<\/strong>: Compare them to the high\/low of the original <em>Shasta<\/em>.<\/p>\n\n\n\n<p class=\"has-background wp-block-paragraph\" style=\"background-color:#8ed1fc\"><strong>Just for fun 2<\/strong>: Check the Histogram of <em>smoothed<\/em>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We can verify that this operation is helpful by viewing the hillshade of the output raster <em>smoothed <\/em>(again using default parameters and not modeling shadows). Compared to the original and filtered images, we have removed most of the speckles but maintained the details.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We could repeat the filter, average, create difference, and apply Con function. It would lead to an improved surface, and we would do this if the noise had significant effect on the project and accuracy.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Finally, you\u2019ll make one nice layout<\/p>\n\n\n\n<ol start=\"8\" class=\"wp-block-list\">\n<li>Zoom to the extent of the DEM<\/li>\n\n\n\n<li>Calculate a hillshade of the <em>smoothed<\/em> raster, name it something like <em>HillSmooth.<\/em>\n<ol style=\"list-style-type:lower-alpha\" class=\"wp-block-list\">\n<li>Azimuth: <strong>315<\/strong> (default)<\/li>\n\n\n\n<li>Altitude: <strong>35<\/strong> degrees<\/li>\n\n\n\n<li>Check <strong>Model Shadows<\/strong><\/li>\n<\/ol>\n<\/li>\n\n\n\n<li>Choose a suitable \u201celevation\u201d palette for the DEM (symbology stretch type for <em>smoothed<\/em> layer is set to Standard Deviation with n=1.5.)<\/li>\n\n\n\n<li>Add <em>HillSmooth<\/em>, making it semi-transparent (50-60%) over the <em>smoothed<\/em> elevation data (<em>Shasta_low<\/em>).<\/li>\n\n\n\n<li>Create a complete Layout\n<ol style=\"list-style-type:lower-alpha\" class=\"wp-block-list\">\n<li>add a reasonable title\/description (<em>e.g.<\/em> Hillshade &amp; Elevation Mount Shasta, Northern California\u201d)<\/li>\n\n\n\n<li>your name, <\/li>\n\n\n\n<li>legend, <\/li>\n\n\n\n<li>north arrow, <\/li>\n\n\n\n<li>scale bar, <\/li>\n\n\n\n<li><strong>and grid<\/strong>.<\/li>\n<\/ol>\n<\/li>\n\n\n\n<li>Export the map as a .pdf and upload to Canvas.<\/li>\n<\/ol>\n\n\n\n<p class=\"has-background wp-block-paragraph\" style=\"background-color:#7bdcb5\"><em>Question 4. Upload map to Canvas<\/em> (name the file with your name <em>e.g.<\/em> <em>&#8220;ex3_q4_yourname.pdf&#8221;<\/em><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h2 id=\"part3\" class=\"wp-block-heading\"><strong>Part 3 \u2013 <strong>Cost surface analysis<\/strong><\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><em>A<em>dapted from <\/em><a href=\"https:\/\/www.gisfundamentals.org\/\" target=\"_blank\" rel=\"noopener\"><em>Bolstad &amp; <\/em>Manson &#8211; Resources<\/a><\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We will create a cost surface for locating optimal places for construction. Our cost surface will depend on slope and distance to existing roads. In our problem, we will assign road construction cost of $25 per meter of road required. We have a vector data layer of roads digitized from USGS maps and we will use grid functions to convert this to a cost data layer.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Slope also affects cost. Roads on steeper terrain are more expensive. The cost is nonlinear, meaning the cost increases slowly for low slopes, then more rapidly at steeper slopes. It is more than 10 times as expensive to build a road on a 20% slope than a 2% slope and impossible to build over a steep threshold.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We provide a roads data layer <em>DuluthNorthRoads.shp<\/em> and a DEM data layer (<em>DulNorthDEM<\/em>) from the northern suburbs of Duluth, Minnesota.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You will calculate a slope cost using the raster calculator. We will create a simple cost model using a couple of formulas. A more accurate analysis would require much more complicated processing, but our approach gives you the general idea while gaining practice with raster calculations.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We will then calculate a distance cost with the distance to the nearest road. A total cost will be made, by adding both the slope cost and distance cost layers. Finally, we wish to apply an upper threshold of $25,000 to consider only those areas that are within our budget.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Task 1 \u2013 Slope cost surface<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Start a new project and add the DEM <em>DulNorthDEM<\/em><\/li>\n\n\n\n<li>Calculate the percent slope <strong>Spatial Analyst Tools &gt; Surface &gt; Slope<\/strong>\n<ol style=\"list-style-type:lower-alpha\" class=\"wp-block-list\">\n<li>Input raster: <em>DulNorthDEM.tif<\/em><\/li>\n\n\n\n<li>Output raster: <em>DulNorth_Slope<\/em><\/li>\n\n\n\n<li>Output measurement: Percent rise<\/li>\n\n\n\n<li>Method: Planar<\/li>\n\n\n\n<li>Z factor: 1<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Study the result slope raster: What are the slopes values (highest and lowest values). Do they appear reasonable?<\/p>\n\n\n\n<p class=\"has-background wp-block-paragraph\" style=\"background-color:#7bdcb5\"><em>Question 5. What is the highest slope value in percent?<br><strong>Hint<\/strong>: you might want to stretch the symbology or get the stats of the layer<\/em><\/p>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li>Next, we will determine the cost of building on slopes using the raster calculator\n<ol style=\"list-style-type:lower-alpha\" class=\"wp-block-list\">\n<li>Input the equation: <strong>Exp(\u201c<\/strong><em>DulNorth_Slope<\/em><strong>\u201d * 0.2)<\/strong><\/li>\n\n\n\n<li>Output raster <em>slope_exp<\/em><\/li>\n<\/ol>\n<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">This applies an exponential function to each cell value and saves it in the output raster <em>slope_exp<\/em><strong>.<\/strong> This is done to scale the slope value to a nonlinear (exponential) value. This formula just makes the values increase exponentially as the slope values increase (don\u2019t pay too much attention on the formula).<\/p>\n\n\n\n<p class=\"has-background wp-block-paragraph\" style=\"background-color:#8ed1fc\"><strong>Hint<\/strong>: Exp (X * 0.2) is the same as <em>e<\/em><sup>(X * 0.2)<\/sup> where <em>e<\/em> is the natural log base ~2.718.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you inspect the output, you\u2019ll note it has a lowest value of 1, and a very large highest value, something like 2.38 x 10<sup>22<\/sup>. The image will appear almost solid black. We need to shave off the highest values, as it can cause functions to calculate too large a value later. We want to place a ceiling on values over 300.<\/p>\n\n\n\n<ol start=\"4\" class=\"wp-block-list\">\n<li>We use the Con function in the Raster Calculator, applying the condition: <strong>Con ((&#8220;slope_exp&#8221;) &gt; 300, 300, &#8220;slope_exp&#8221;)<\/strong>\n<ol style=\"list-style-type:lower-alpha\" class=\"wp-block-list\">\n<li>Call the output <em>slope_exp300<\/em><\/li>\n<\/ol>\n<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Recall that the Con function takes these inputs: <em>Con (condition, value if condition is true, value if condition is false)<\/em><\/p>\n\n\n\n<ol start=\"5\" class=\"wp-block-list\">\n<li>Study the results. Use a symbology that shows the different values for the different slopes <br>(maybe use Classify with 15-10 classes)<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">We will now calculate slope cost. We choose a formula that the cost is $1000 times the slope factor, starting at 0 extra dollars for a flat (0 slope) surface.<\/p>\n\n\n\n<ol start=\"6\" class=\"wp-block-list\">\n<li>Using the raster calculator, derive a <em>slopecost<\/em> raster. Apply the formula <strong>\u201c<em>slope_exp300<\/em>\u201d * 1000 \u2013 1000<\/strong>\n<ol style=\"list-style-type:lower-alpha\" class=\"wp-block-list\">\n<li>Name the output raster <em>slopecost<\/em>.<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n\n\n\n<p class=\"has-background wp-block-paragraph\" style=\"background-color:#8ed1fc\">Any idea why the final \u201c-1000\u201c at the end of the formula?<br><strong>Hint:<\/strong> When we calculated exponential, what is the exp(0)? <br><strong>Hint 2<\/strong>: check the lowest value of Slope_exp300 in the CP<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"alignright size-full\"><a href=\"https:\/\/commons.mtholyoke.edu\/emarcano\/wp-content\/uploads\/sites\/965\/2026\/09\/slope_exp300.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"249\" height=\"253\" src=\"https:\/\/commons.mtholyoke.edu\/emarcano\/wp-content\/uploads\/sites\/965\/2026\/09\/slope_exp300.jpg\" alt=\"slope cost\" class=\"wp-image-2334\" \/><\/a><\/figure>\n<\/div>\n\n\n<ol start=\"7\" class=\"wp-block-list\">\n<li>Assign a suitable symbology (see figure)\n<ol style=\"list-style-type:lower-alpha\" class=\"wp-block-list\">\n<li>Specify the <strong>Min-Max stretch<\/strong> type, with <strong>custom statistics<\/strong>, and specified <strong>0 Min, 25000 Max<\/strong> in the lower options of the Symbology pane<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">You should have something that looks like the image when applying a max-min symbology over the 0 &#8211; $25,000 range to your slope cost (your choice of palette may be different).<\/p>\n\n\n\n<div style=\"height:13px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h3 class=\"wp-block-heading\">Task 2 \u2013Distance from road cost surface<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Now, we will calculate distance from road cost.<\/p>\n\n\n\n<ol start=\"8\" class=\"wp-block-list\">\n<li>Add the <em>DuluthNorthRoads<\/em>.shp vector layer to your map (if you don\u2019t have it already).<\/li>\n\n\n\n<li>Calculate the distance from roads raster with the Euclidean Distance tool <strong>Spatial Analyst Tool &gt; Distance &gt;<\/strong> <strong><a>Distance<\/a> Allocation.<\/strong>\n<ol style=\"list-style-type:lower-alpha\" class=\"wp-block-list\">\n<li>Input: <strong><em>DuluthNorthRoads<\/em><\/strong><\/li>\n\n\n\n<li>Output <strong>Distance<\/strong> Accumulation Raster: <strong><em>Distance<\/em> &nbsp;<\/strong>(<strong>NOTE<\/strong>: not \u201cDistance Allocation\u201d)<\/li>\n\n\n\n<li>Distance Method: <strong>Planar<\/strong><\/li>\n\n\n\n<li><strong>On top of the dialog click on Environments<\/strong>\n<ol class=\"wp-block-list\">\n<li>Open Raster Analysis and choose cell size: <strong>3 (<\/strong>the cell size of our slope cost layer; please verify that this is so)<\/li>\n<\/ol>\n<\/li>\n\n\n\n<li>Leave other values as default and RUN<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n\n\n\n<p class=\"has-background wp-block-paragraph\" style=\"background-color:#8ed1fc\"><strong>Hint<\/strong>: Disregard (and get rid of) of any layer called <em>\u201cDistanc_Dulu1\u201d<\/em> or something like that in the CP, we only want <em>\u201cDistance\u201d<\/em><\/p>\n\n\n\n<p class=\"has-background wp-block-paragraph\" style=\"background-color:#8ed1fc\"><strong>Hint 2:<\/strong> Click on multiple places on <em>Distance<\/em> and notice how the numbers increase as you move away from the roads. It should be \u201c0\u201d right on the roads up to a maximum of 6426+ meters.<\/p>\n\n\n\n<ol start=\"10\" class=\"wp-block-list\">\n<li>Now we will Calculate distance cost using <strong>Raster Calculator<\/strong> by assigning a cost of $25 per meter away from a road\n<ol style=\"list-style-type:lower-alpha\" class=\"wp-block-list\">\n<li>Enter formula: <strong>\u201c<em>Distance\u201d<\/em> &nbsp;*25<\/strong><\/li>\n\n\n\n<li>Output: <em>Distance_cost<\/em><\/li>\n<\/ol>\n<\/li>\n<\/ol>\n\n\n\n<p class=\"has-background wp-block-paragraph\" style=\"background-color:#8ed1fc\"><strong>Hint<\/strong>: You should get a layer with range of values approximately from 0 to about 160,660<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Task 3 \u2013Total cost<\/strong><\/h3>\n\n\n\n<ol start=\"11\" class=\"wp-block-list\">\n<li>In the Raster calculator <strong>add <\/strong><em>(as in summation) Distance_cost<\/em> plus <em>Slope_cost<\/em>, to calculate a total cost surface T<em>otal_cost<\/em><\/li>\n<\/ol>\n\n\n\n<p class=\"has-background wp-block-paragraph\" style=\"background-color:#8ed1fc\"><strong>Hint<\/strong>: You should get a layer with range of values approximately from 0 to about 345,425<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"alignright size-full is-resized\"><a href=\"https:\/\/commons.mtholyoke.edu\/emarcano\/wp-content\/uploads\/sites\/965\/2026\/09\/total_cost.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"699\" height=\"725\" src=\"https:\/\/commons.mtholyoke.edu\/emarcano\/wp-content\/uploads\/sites\/965\/2026\/09\/total_cost.jpg\" alt=\"total cost\" class=\"wp-image-2336\" style=\"width:300px;height:auto\" srcset=\"https:\/\/commons.mtholyoke.edu\/emarcano\/wp-content\/uploads\/sites\/965\/2026\/09\/total_cost.jpg 699w, https:\/\/commons.mtholyoke.edu\/emarcano\/wp-content\/uploads\/sites\/965\/2026\/09\/total_cost-289x300.jpg 289w\" sizes=\"auto, (max-width: 699px) 100vw, 699px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">The highest values result from the steepest slopes. It is a long-tailed distribution, meaning there are a few very high values. <\/p>\n\n\n\n<ol start=\"12\" class=\"wp-block-list\">\n<li>Check the Histogram of <em>Total_cost<\/em> to observe this distribution. <\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">This skews symbology visualization, and obscures much of the variation. If we cut off the stretch at 10,000 then we show more detail.<\/p>\n\n\n\n<ol start=\"13\" class=\"wp-block-list\">\n<li>In the symbology pane for <em>Total_cost<\/em> use\n<ol style=\"list-style-type:lower-alpha\" class=\"wp-block-list\">\n<li>Primary symbology: Stretch<\/li>\n\n\n\n<li>Stretch type: Min max<\/li>\n\n\n\n<li>Statistics: Custom<\/li>\n\n\n\n<li>Min: 0<\/li>\n\n\n\n<li>Max: 10,000<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Note the drop-off near the roads at this stretch, with a threshold above 10,000 reached, due to the distance function.&nbsp; Your result should look like the image (depending on your color scheme, this is using a green-red (called \u201cCondition Number\u201d<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h3 class=\"wp-block-heading\">Task 4 \u2013 Reclassification<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">We\u2019re now going to reclassify these values into a smaller number of classes.&nbsp; We wish to consider only areas where the total costs are below $25,000. We need to create a mask, with 1 where the total cost is below $25,000, and NoData where the total cost is above $25,000 (refer to the explanation at the beginning of part 3 to understand this objective).<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"alignright size-full\"><a href=\"https:\/\/commons.mtholyoke.edu\/emarcano\/wp-content\/uploads\/sites\/965\/2026\/09\/totalcostmask.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"359\" height=\"333\" src=\"https:\/\/commons.mtholyoke.edu\/emarcano\/wp-content\/uploads\/sites\/965\/2026\/09\/totalcostmask.jpg\" alt=\"\" class=\"wp-image-2338\" srcset=\"https:\/\/commons.mtholyoke.edu\/emarcano\/wp-content\/uploads\/sites\/965\/2026\/09\/totalcostmask.jpg 359w, https:\/\/commons.mtholyoke.edu\/emarcano\/wp-content\/uploads\/sites\/965\/2026\/09\/totalcostmask-300x278.jpg 300w\" sizes=\"auto, (max-width: 359px) 100vw, 359px\" \/><\/a><\/figure>\n<\/div>\n\n\n<ol start=\"14\" class=\"wp-block-list\">\n<li>&nbsp;Go to <strong>Spatial Analyst Tools &gt; Reclass &gt; Reclassify<\/strong>\n<ol style=\"list-style-type:lower-alpha\" class=\"wp-block-list\">\n<li>Input Raster: <em>total_cost<\/em><\/li>\n\n\n\n<li>Reclass field: VALUE<\/li>\n\n\n\n<li>Classify just 2 classes using 25000 as the upper value for the first class\n<ul class=\"wp-block-list\">\n<li>Assign a value to 1 to the lowest class and NODATA to everything above 25000 (Make sure to hit ENTER after inputting a new value)<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Output Raster: <em>Classmask<\/em><\/li>\n\n\n\n<li>Click <strong>Run<\/strong> to execute the function<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">The reclassify operation should result in a mask layer called <em>classmask<\/em> that looks something like the figure.<\/p>\n\n\n\n<p class=\"has-background wp-block-paragraph\" style=\"background-color:#7bdcb5\"><em>Question 6. How many cells of Classmask have a value of less than $25000? <\/em><br><em>(<strong>Hint: <\/strong>value 1; careful when typing the number)<br>(<strong>Hint 2<\/strong>: &gt;26 million)<\/em><\/p>\n\n\n\n<ol start=\"15\" class=\"wp-block-list\">\n<li>Now use the raster calculator to <strong>multiply<\/strong> the mask (<em>classmask<\/em>) by the total cost (<em>Total_cost<\/em>) layer.\n<ol style=\"list-style-type:lower-alpha\" class=\"wp-block-list\">\n<li>Call the output <em>Final_Cost<\/em>.<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\"><br>This final cost layer shows you the best places for construction according to our criteria of proximity to roads and low slope and with a cost of less than $25,000 per 10 square meters (actually 9, cell size is 3m). You&#8217;d provide this map to the person(s) in charge of making the final decision of where to build.<br><br><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"#top\">Return to Top of page<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/commons.mtholyoke.edu\/emarcano\/geog323\">Return to Geog 323 page<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Raster processing and cost surface analysis Contents Return to Geog 323 page Part 1: Resampling and combination of rasters Adapted from Bolstad &amp; Manson &#8211; Resources We often obtain DEM data with various errors, a cell size different that we wish to have, or at different resolutions for different parts [&hellip;]<\/p>\n","protected":false},"author":793,"featured_media":0,"parent":2130,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_monsterinsights_skip_tracking":false,"footnotes":""},"class_list":["post-2316","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/commons.mtholyoke.edu\/emarcano\/wp-json\/wp\/v2\/pages\/2316","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/commons.mtholyoke.edu\/emarcano\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/commons.mtholyoke.edu\/emarcano\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/commons.mtholyoke.edu\/emarcano\/wp-json\/wp\/v2\/users\/793"}],"replies":[{"embeddable":true,"href":"https:\/\/commons.mtholyoke.edu\/emarcano\/wp-json\/wp\/v2\/comments?post=2316"}],"version-history":[{"count":39,"href":"https:\/\/commons.mtholyoke.edu\/emarcano\/wp-json\/wp\/v2\/pages\/2316\/revisions"}],"predecessor-version":[{"id":2396,"href":"https:\/\/commons.mtholyoke.edu\/emarcano\/wp-json\/wp\/v2\/pages\/2316\/revisions\/2396"}],"up":[{"embeddable":true,"href":"https:\/\/commons.mtholyoke.edu\/emarcano\/wp-json\/wp\/v2\/pages\/2130"}],"wp:attachment":[{"href":"https:\/\/commons.mtholyoke.edu\/emarcano\/wp-json\/wp\/v2\/media?parent=2316"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}