Golden Software Blog

Helping you learn more about the latest product information, tips, tricks, techniques, and customer stories so you can visualize data and communicate results with ease.

Creating Terrain Slope Maps from Digital Elevation Models in Surfer

Creating a map of slopes is common practice when looking at slope stability. Some examples of when you may want to create slope maps would be to identify areas with high slope to indicate avalanche or landslide danger. Another example may be to present slope maps of the seabed so that a structure with set tolerances for inclination could be located. Slope and gradient maps can be easily generated using Surfer.

Slope information can be easily computed from grid, raster or digital elevation models (DEMs) using options under the Grid | Calculus menu command in Surfer. The slope values can be expressed either in degrees or as a decimal (rise/run) which can then be computed as a percentage. For example, using Grid | Calculus you could select:

  1. Terrain Modeling | Terrain Slope. This option generates a grid file of the slopes expressed in degrees, from 0° (horizontal) to 90° (vertical). This is the most commonly used option to create a grid file of terrain slopes.
  2. Differential and Integral Operators | Gradient Operator. This option generates a grid file of the slope or gradient expressed as a decimal ratio of rise over run, from zero (horizontal) to approaching infinity at vertical. To calculate slopes as a percentage (e.g. 15%) instead of a decimal, use Grid | Math to multiply the Gradient Operator results by 100.

Terrain slope maps

Using a digital elevation model (or any grid file), create slope maps either by calculating terrain slope in degrees or the gradient of the slope in percent.

Let’s walk through an example. Let’s say we have an area that is prone to avalanches and we want to indicate on a map the areas where the slope is greater than 30°. To do this, follow these steps:

  1. First, let’s create a map of the area
    1. Click Map | New | 3D Surface Map, select LovelandPass_DryGulch.grd and click Open.
    2. Let’s drape an aerial image over it. Click on the map to select it and click Map | Add | Base Layer, select LovelandPass.tif and click Open
    3. Click Yes to adjust the limits.
    4. You can change the properties of the 3D surface layer to see the draped image a little better. 
      1. Select the 3D Surface layer in the Object Manager.
      2. In the Property Manager, click the General tab.
      3. Click the 2 button button to the right of Upper
      4. In the Colormap dialog, set the Preset to GrayScale (at the top of the list)
      5. Click the color node on the left side of the colormap and change the Color to White (so the colormap goes from white to white). 
      6. Click OK.
      7. Click the Lighting tab and set the Vertical (degrees) light position to 80. This brightens the map up a bit.
    5. Select Map in the Object Manager and in the Property Manager click the Scale tab.
    6. In the Z Scale section, set the Map units per in. to 720.8333333, eliminating the vertical exaggeration.

    3D surface map with draped geoTIFF
    Create a 3D surface map and drape a georeferenced image on top of it to visualize the DEM.

  2. Now let’s calculate the grid of slope data, in degrees.
    1. Click Grid | Calculus, select LovelandPass_DryGulch.grd and click Open.
    2. Select Terrain Modeling | Terrain Slope.
    3. Click the Change Filename button to the right of Output Grid File
    4. Enter the name LovelandPass_DryGulch_Slope.grd and click Save.
    5. Click OK and the grid is created. 

    Terrain Slope
    Select the Terrain Modeling | Terrain Slope option in the Grid Calculus dialog.

  3. Add contours of the slope data to the existing map. Click on the map to select it.
  4. Click Map | Add | Contour Map, select LovelandPass_DryGulch_Slope.grd and click Open. Contours of the slope are added to the map.

    Slope contours draped on 3D map
    Add slope contours to the 3D surface map

  5. Now we can highlight the areas above 30 degrees, which indicate the zones of avalanche danger. 
    1. Select the Contours layer in the Object Manager.
    2. In the Property Manager, click the Levels tab. 
    3. Set the Minimum contour level to 30.
    4. Change the contour Interval to cover the entire range of values (e.g. 40). Now I can see on the map where the slope is greater than 30°.
    5. Check the Fill contours check box to fill the contours.
    6. Change the Level method to Advanced and click the Edit Levels button.
    7. In the Levels for Map dialog:
      1. Double click on the level button under the Fill column and set the fill to a solid red foreground color with 25% opacity. Click OK.
      2. Double click on the level button under the Line column and set the line properties to the desired color, such as a red 0.010 inch line. Click OK.
      3. Under the Label column, double click Yes to change it to No.
    8. Click OK in the Levels for Map dialog to apply the changes.

Slope draped over 3D surface
Set the contour levels to visualize the areas that have a slope above a 30° angle.

Another way to visualize this data is to create a base map of a USGS DRG file showing the elevation contours, and overlaying that map with a contour layer of the slope data.

Slope map over DRG
Additionally visualize the slope results on a 2D map of elevation contours. Print this map to take with you in the field.

Please note that when calculating slopes from DEM or grid files, Surfer uses the X, Y and Z values proportionally when calculating the slope values. Therefore, the X, Y and Z values must be in the same units, and the units must be linear (e.g. feet or meters) for the slope calculation to be correct.  If the X and Y units in the grid file are in lat/lon, then the slope calculated for each node will be almost vertical because the X and Y extents (the lat/lon ranges) are so small compared to the difference in Z values. In this case, convert the coordinate system of your data, DEM or grid file from lat/lon to another system with linear units prior to calculating the slope. For instructions on how convert the XY coordinates for raw data, DEMs, please see our newsletter article: Converting the Coordinate System of Data, Image, Vector, and Grid Files in Surfer .

Slope maps can be powerful tools when evaluating sites for safety, field engineering, projecting road layouts or drainage patterns, and many other applications. Surfer can also calculate other terrain modeling information, such as aspect and curvature to make sure you get the information you need to make informed decisions.

Other Resources:

  1. Click Help | Contents. On the Contents page, navigate to Surfer 13 | Gridding | Grid Operations | Grid Calculus.
  2. Blog article: Calculate Terrain Slope Using Surfer 10's Mapping Software
  3. Knowledge Base articles:
    1. How can I calculate slope as a percentage?
    2. How can I find the maximum slope within an area around a point?
    3. How can I find the slope of a terrain at a specific XY point?
    4. When I use the Data Metrics Terrain Slope gridding option, the resulting grid is a horizontal plane. What happened?
    5. How do I create a vector map with magnitude and direction arrows at the data points?
    6. How can I export the direction and magnitude data from a 1-grid vector map?
    7. When I create a grid of Terrain Slope, why is the reported slope in the resulting grid all 89 or 90°?
    8. When I create a grid of Terrain Slope, why is the reported slope in the resulting grid all 89 or 90 degrees?
 

Comments 2

Guest - Pieter-Jan Grabe on Friday, 02 September 2016 07:28

Articles vey helpful. I used terrain modelling to define possible alluvial deposit boundaries.

Articles vey helpful. I used terrain modelling to define possible alluvial deposit boundaries.
Guest - Tahir on Monday, 20 June 2016 04:49

Dear Sir,

Thanks For Sharing, Your Article Is Very Useful For Digital Modeling... I Gland This Topic...

3D Rendering Studio.
http://www.thecheesyanimation.com

Dear Sir, Thanks For Sharing, Your Article Is Very Useful For Digital Modeling... I Gland This Topic... 3D Rendering Studio. http://www.thecheesyanimation.com
Guest
Tuesday, 17 January 2017

Captcha Image

Keep Reading

12 July 2016
Surfer

My last blog article described how to create a slope map from a digital elevation model in Surfer. Moving forward on that topic, I found this blog article written for ArcMap on creating aspect-slope maps, which was improved upon for QGIS. This single map combines both the compass direction of slopes (aspect) and the steepness of the slopes (in degrees) and uses both color and saturation to display the combined results. Slopes facing different directions use different colors, and the brightness of that color shows the steepness of that slope (the brighter the color, the steeper the slope). I thought this was a really interesting map type and it made me wonder how this could be done in Surfer.

Coincidentally, at that time, a user asked me this exact question! The user wanted to come up with a way to see the very small slope variations in the soft sediments they have on the surface, using both aspect and slope. Looking at the slopes and aspect together may reveal small variations that otherwise could be overlooked.

Surfer 2D & 3D Mapping Software: Aspect-slope maps Create aspect-slope maps to get an idea for both the direction
of slope and the amount of slope in one view.

Before we delve into the steps on how to create this type of map, I want to go over a little background on what the colors represent.

Background

To create an aspect-slope map in Surfer, all you need to start with is a grid, DEM, or DTM file. Using the method described in the QGIS article, the idea is to create a grid of slopes (in %) and create grid of aspect directions. Reclassify the slope grid into bins from 0 to 8 in steps of 2, and reclassify the aspect grids into bins from 10 to 80 in steps of 10.

Original Slope% Z Value New Z Value
>=0.0 and <5.0 0
>=5.0 and <15.0 2
>=15.0 and <30.0 4
>=30.0 and <45.0 6
>=45.0 8

 

Original Aspect Z Value New Z Value
>=0 and <22.5 10
>=22.5 and <67.5 20
>=67.5 and <112.5 30
>=112.5 and < 157.5 40
>=157.5 and <202.5 50
>=202.5 and <247.5 60
>=247.5 and <292.5 70
>=292.5 and <337.5 80
>=337.5 and <360.5 10

Reclassify the slope (%) and aspect grid files so that the slope values are even numbers from 0 to 8, and the aspect values are ten values from 10 to 80.

Combine the reclassified grids by adding them together to create a single aspect-slope grid. For the combined grid, the values can range anywhere from 10 to 88­, which is the minimum of the slope plus the minimum of aspect (10+0) and the maximum of the slope plus the maximum of the aspect (80+8). The first digit in the number in the ten’s place is the aspect orientation, and the second digit in the one’s place is the slope.  For example, a value of 24 in the combined grid indicate a slope in the direction between 22.5° and 67.5° azimuth (since the first digit is 2), and the slope would be between 15% and 30% (since the second digit is 4).

We will then create a map and color it based on this combined value. The actual color is based on the aspect value (the first digit in the ten’s place) and the brightness of that color based on the slope value (the second digit in the one’s place). Since any value that has a 0 in the one’s place (e.g. 10, 20, 30, etc.) is relatively flat (a slope between 0-5°), we can assign it a flat gray color that we can make completely transparent. For the other colors, we can use colors based on a wheel like the image below. For example, a value of 24 in the combined grid would be assigned a medium green color.

Color wheel for aspect-slope mapsThis color wheel was selected from the ArcMap article. The color around the wheel is based on the aspect (slope direction), and is identified by the first digit in the 10’s place of the Z values in the combined grid. The brightness of that color is based on the slope itself, identified by the second digit in the 1’s place of the Z values in the combined grid.

Performing the steps manually is not very difficult, but they do take some time. I decided to shorten this workflow significantly by writing a script, compatible with Surfer 13. The manual process of walking through the steps only takes about 5 minutes, but the script takes only seconds and is wonderfully easy. I’ll provide instructions for both running the script and manually walking through the steps.

Steps to Create an Aspect-Slope Map using a Script

To run the script to create the aspect-slope map in seconds, follow these steps:

  1. Download the script Aspect-Slope.bas and the colormap file ColorWheel.clr .
  2. Open Scripter by clicking Windows Start | All Programs (or All apps) | Golden Software Surfer 13 | Scripter.
  3. In Scripter, click File | Open, select Aspect-Slope.bas and click Open.
  4. Click Script | Run.
  5. Select the grid file you wish to use (such as Diablo.grd from the Surfer Samples folder) and click Open.
  6. Select the ColorWheel.clr color file and click Open. The script works to completion.

That’s it! Surfer is opened and the map is created with the appropriate values and colors. Even with a large grid file, this takes only seconds on my computer.

Surfer 2D & 3D Mapping Software: Aspect slope map creationRun the Aspect-Slope.bas script to create an aspect-slope map from any grid in just a few seconds.

Steps to Create an Aspect-Slope Map Manually

If you want to work through this manually, the equivalent steps to perform in Surfer are as follows:

  1. Create the grid of slope values (in rise/run).
    1. Click Grid | Calculus.
    2. Select your grid file, such as Diablo.grd from the Surfer Samples folder, and click Open.
    3. In the Grid Calculus dialog, select Differential & Integral Operator | Gradient Operator.
    4. Click the Change Filename button to the right of Output Grid File, give the file a new name (e.g. Diablo_Slope.grd) and click Save.
    5. Click OK and the grid is created.
  2. Convert the slope grid in rise/run to percent slope.
    1. Click Grid | Math.
    2. In the Grid Math dialog, click the Add Grids button.
    3. Select Diablo_Slope.grd and click Open.
    4. Enter the function: A*100
    5. Click the Change Filename button to the right of Output Grid File, give the file a new name (e.g. Diablo_Slope_Percent.grd) and click Save.
    6. Click OK and the grid is created.
  3. Reclassify the slope grid file using Grid Math.
    1. Click Grid | Math.
    2. In the Grid Math dialog, click the Add Grids button.
    3. Select Diablo_Slope_Percent.grd and click Open.
    4. Enter the function:  IF (A>=45, 8, IF (A>=30.0 AND A<45, 6, IF (A>=15 AND A<30, 4, IF (A>=5 AND A<15,2, IF(A>=0 AND A<5, 0, A)))))
    5. Click the Change Filename button to the right of Output Grid File, give the file a new name (e.g. Diablo_Slope_Percent_Reclass.grd) and click Save.
    6. Click OK and the grid is created.
  4. Create the grid of aspect values.
    1. Click Grid | Calculus.
    2. Select your grid file, such as Diablo.grd from the Surfer Samples folder, and click Open.
    3. In the Grid Calculus dialog, select Terrain Modeling | Terrain Aspect.
    4. Click the Change Filename button to the right of Output Grid File, give the file a new name (e.g. Diablo_Aspect.grd) and click Save.
    5. Click OK and the grid is created.
  5. Reclassify the aspect grid file using Grid Math.
    1. Click Grid | Math.
    2. In the Grid Math dialog, click the Add Grids button.
    3. Select Diablo_Aspect.grd and click Open.
    4. Enter the function:  IF (A>=337.5 OR A<22.5, 10, IF (A>=22.5 AND A<67.5, 20, IF (A>=67.5 AND A<112.5, 30, IF (A>=112.5 AND A<157.5,40, IF(A>=157.5 AND A<202.5,50, IF(A>=202.5 AND A<247.5,60, IF(A>=247.5 AND A<292.5,70, IF(A>=292.5 AND A<337.5, 80, A))))))))
    5. Click the Change Filename button to the right of Output Grid File, give the file a new name (e.g. Diablo_Aspect_Reclass.grd) and click Save.
    6. Click OK and the grid is created.
  6. Add the reclassified slope and aspect maps together, also using Grid Math.
    1. Click Grid | Math.
    2. In the Grid Math dialog, click the Add Grids button.
    3. Select both Diablo_Slope_Percent_Reclass.grd and Diablo_Aspect_Reclass.grd and click Open.
    4. Enter the function:  A+B
    5. Click the Change Filename button to the right of Output Grid File, give the file a new name (e.g. Diablo_AspectSlope.grd) and click Save.
    6. Click OK and the grid is created.
  7. Create the map and color it using the colors defined above.
    1. Click Map | New | Image Map, select Diablo_AspectSlope.grd and click Open.
    2. Select the Image layer in the Object Manager, and click the General page in the Property Manager.
    3. Under the Hill Shading section, uncheck Enable hill shading.
    4. Under the General section,
      1. Uncheck Interpolate pixels.
      2. Click the Custom colormap (…) button to the right of Colors.
      3. In the Colormap dialog, click Load, select ColorWheel.clr, and click Open.
      4. Click OK.
      5. Check Show color scale.
    5. Under the Missing Data section, set the Opacity to 0%.

Surfer 2D & 3D Mapping Software: Aspect slope map created in SurferCreate aspect-slope maps in the Surfer user interface.

Capturing both slope and aspect in a single map is an excellent way to identify large and small scale trends in a map. You have tremendous flexibility in Surfer. You can adjust the classifications if you wish, to emphasize certain slope or aspect ranges by adjusting the Grid Math functions, or you can choose to make the flat areas solid gray instead of transparent by setting the Opacity in the Colormap dialog to 100%. There are many options you can choose from so that this map shows exactly what you need it to.

1451 Hits 0 Comments Read More
11 November 2016
Surfer

I recently received a call from one of our Surfer users who was trying to create a site suitability model for a new manufacturing development. The user needed to find areas within the proposed site where the slope was under 10 degrees. The site suitability model required specific slope to be respected; the areas that were under the threshold criteria of 10% would be considered potential locations within the site to locate the new development.


A site suitability model can be easily developed in Surfer by creating a slope grid from a digital elevation model or DEM for the area, masking the slope grid to the site boundary, and creating a contour map that highlights the areas that meet the 10% or under criteria. Since this is such an interesting workflow, I thought it would be a great topic to blog about it so others in the Surfer community could benefit from seeing the approach.


Create a Slope Grid in Surfer
The first step in creating the suitability model is to determine the slope of the DEM of the site using Surfer. Surfer’s Grid | Calculus command can be used to do this easily by following these steps:

  1. In Surfer, click Grid | Calculus.
  2. In the Open Grid dialog, navigate to the GRD or DEM and click Open.
  3. In the Grid Calculus dialog, expand the Terrain Modeling selection and select Terrain Slope.
  4. Name the Output Grid File and click OK to create the slope grid.

Highlighting the 10% Slope Areas
Now that the slope grid has been created from the digital elevation model, it needs to be blanked by the proposed site boundary so that only the areas within the site boundary contain slope data. To blank the slope grid:

  1. Click Grid | Blank.
  2. In the Open Grid dialog, navigate to the digital elevation model and click Open.
  3. In the Open dialog, navigate to the BLN file of the area of interest and click Open.
  4. In the Save Grid As dialog, name the grid and click Save.


Now that the slope grid has been blanked to the potential site boundary, a contour map can be created that highlights the areas within the site boundary that have a slope of 10% or less. This can be done by adding slope contours at 0% slope, 5% slope, and 10% slope.

  1. Click Map | New | Contour Map.
  2. In the Open Grid dialog, navigate to the blanked slope grid and click Open.
  3. In the Object Manager, click the Contours layer to select it.
  4. In the Property Manager, click the Levels tab.
  5. Change the Level Method to Advanced and click the Edit Levels button.
  6. In the Levels for Map dialog, delete all of the levels except 0, 5, and 10.
  7. Assign these levels an appropriate color and fill pattern and click OK.

 


We now have a map of the locations within the site boundary that are less than 10% slope. In the map above, areas that are green are the most suitable for locating the new development and are under 5% slope. Areas that are highlighted in yellow are between 5% and 10% slope, which is still suitable for locating the development.  All areas in red have a slope over 10% and are not good location candidates for the new development. The contours can also be exported from Surfer to be used in 3rd party mapping and CAD applications.

 

1112 Hits 0 Comments Read More

Subscribe To Our Blog

Most Popular

This week many users experienced a GsDraw error (1): GenericError. This error began occurring follow...
This week's new feature series is a tutorial on how to use the new coordinate system dialogs in MapV...
Over the years, one of the most common questions asked is “How can I get my contour map out of Surfe...

Exceeding expectations

Go to top