Wikipedia:Graphics Lab/Resources/Creating shaded relief (GRASS, 3DEM)

The object of this tutorial is to create (composite) relief shadows resulting from a digital elevation model (DEM) created using the programs 3DEM or GRASS GIS.

The tools
or:
 * 3DEM (version used: 20.0): free and easy to use GIS editor;
 * GRASS GIS (version used: winGRASS 6.3.0RC6): free multi platform GIS program; powerful but more delicate to use;

Potential data sources
These are bitmap files released into the public domain, compressed into zip file format, which contain the digital topographic data of a given region. The zone covered by the DEMs resulting from the SRTM runs from latitude 56° South to latitude 60° North. These files must be decompressed before being used in 3DEM.
 * NASA Shuttle Radar Topography Mission (SRTM) Digital Elevation Model (DEM):

There are three SRTM file types:
 * SRTM1 (download here): the most precise data with a resolution of one arcsecond (31 m at the equator), but which are only available for the United States and its dependencies. Each file represents a rectangle of a degree of an arc to a side referenced according to the coordinates of the bottom left corner..


 * SRTM3 (download here): a precision of three arcseconds (93 m at the equator) which covers all emerged land between the latitudes indicated above. Filetypes and references identical to SRTM1.  These are the datasets which will be of most use for the needs of Wikipedia.


 * SRTM30 (download here): a precision of 30 arcseconds (926 m at the equator), adapted for maps covering more than one country or a continent.
 * Each map covers a region of 50° of latitude by 40° of longitude, referenced according to the coordinates of the upper left corner. Each map is contained in a specific folder which contains 12 separate files.  Only 10 of these will be of use to us; the remaining files *.jpg.zip and *.gif.zip are just preview files.  These 10 files must each be downloaded and decompressed before being used in 3DEM.  In the program, select the GTOPO30 Tile option, then in the new window representing the map of the world, centre the frame on the region of interest and specify Lat/Lon as the projection type.  Navigate through the tree and select the .DEM file.

With GRASS GIS

 * 1. Open GRASS and enter into the project that follows a UTM projection. Launch the module r.shaded.relief (Raster -> Terrain analysis -> Shaded relief).


 * 2. In the module window, click on the button of the Input elevation map: field and select the DEM map which has previously been imported into GRASS. By default, GRASS uses an illumination coming from the West (270° - from the left), but in cartography the norm has illumination coming from the North-West (upper left corner).  This illumination, impossible in reality for the northern hemisphere, has become a convention and in particular avoids the optical illusion of a relief inversion in which one has the impression of seeing valleys as mountains and vice versa. In the field Output shaded relief map name:, enter a name for the first shaded relief map which will be created; for example, Shadows_315.  In the field Altitude of the sun..., specify a value of around 60°.  For the azimuth, enter <tt>315</tt> and leave the factor for exaggerating relief field at <tt>1</tt>, unless the terrain is particularly flat which will result in low visibility shadows.  Click on the Run button to start the operation which is detailed in the Output - GIS.m window.


 * 3. When the operation has been completed (indicated by the phrase "Shaded relief map created and named <Shadows_315>."), you can preview these shadows to check whether the aspect is correct (the height of the Sun and thus the luminosity of the map, the factor of exaggeration of relief, etc). In the GRASS manager window, create a bitmap layer then click on the Base map button and select the file <tt>Shadows_315</tt>. In the Map Display 1 window, click on the Display active layers button to display the map.


 * 4. In the <tt>r.shaded.relief</tt> module window, change the azimuth to <tt>275°</tt>. Change the output filename to <tt>Shadows_275</tt>, then click on the Run button.  Repeat the operation for an illumination from <tt>355°</tt>.  Close the module.


 * 5. Export the first shaded relief map in <tt>PNG</tt> format: File -> Export raster map -> PNG. In the <tt>r.out.png</tt> module window, select the file <tt>Shadows_315</tt>.  In the field Name for new PNG file:, replace <tt> </tt> with <tt>Shadows_315</tt>, then click on the Run button.  The file is saved by default in the <tt>C:\GRASS</tt> directory.


 * 6. Modify the output filenames for the other two shaded relief maps. Exit GRASS.

With 3DEM

 * 1. Open 3DEM. Click on File -> Load Terrain Model (1). Select the SRTM Data option (2) then in the new window files of type <tt>.hgt</tt>.


 * 2. As the DEM has empty pixels, they must be patched: press <tt>F7</tt> and select the whole map with the mouse (1). Confirm the selection by pressing <tt>Enter</tt>. 3DEM fills in these pixels by interpolating values from adjacent pixels. (2)


 * 3. Change the projection: Operation -> Change Projection -> Convert to UTM Projection (1). Select the WGS84 option (2) which is the norm used by the SRTM files. Click OK.  The map is redrawn and the meridians, which were previously parallel, now converge towards the poles.
 *  Note:  The following screen captures show the map with the colours recommended by the suggested Wikipedia map colouring convention, but changing the colours is not a required step in this tutorial.


 * 4. If, after confirming, a message appears indicating that the map is too large and that a smaller area must be chosen, this means that your map covers more than one UTM zone; an operation that 3DEM is currently not capable of displaying. In such cases it is necessary to crop the map: press <tt>F8</tt> and select a smaller area with the mouse over the whole height of the map, then confirm by pressing <tt>ENTER</tt>.  Continue with the modification of the projection as indicated in point 3.  This action must be repeated for the other part of the map, which requires reloading the relevant DEMs into 3DEM and repeating the operation from point 1.


 * 5. Resize the map: press <tt>F6</tt> and move the cursor to the required values for height and width.


 * 6. Export the map: check that the coordinate grid is visible (Geo Coordinates -> Lat-Lon Grid On) (1), then select File -> Save Map Image (2) and choose <tt>jpeg</tt> format (3), and choose a name for the image. Save. This map, compressed into <tt>.jpg</tt> format, is only intended to serve as a reference for the transformations required for the final map (rotation, layer alignment etc). Turn off the grid (Geo Coordinates -> Lat-Lon Grid Off).


 * 7. Press <tt>F3</tt> and modify the colorimetric terrain scale by specifying the colour white for each altitude range, in order to remove topographic information.


 * 8. As the DEMs of the SRTM are imprecise in coastal zones, we will force 3DEM to consider that there is no ocean to avoid the "stepped" appearance of the coastline in these areas in comparison with the trace produced by the SRTM Water Body Data (SWBD). In the Terrain Type section of the Terrain colors window, <tt>F3</tt>, select the option Mountain/Plain: 3DEM applies a grey colour, corresponding to a flat unshadowed plain, to all aquatic surfaces.  This method is empiric but adapted to the needs of Wikipedia because it renders these defaults practically invisible.


 * 9. Modify the illumination of the map: by default, 3DEM uses an illumination coming from South West (240° - the bottom left corner), which is natural but in cartography the norm is to have illumination coming from the North West (upper left corner). This illumination, impossible in reality for the northern hemisphere, has become a convention and in particular avoids the optical illusion of a relief inversion in which one has the impression of seeing valleys as mountains and vice versa.  Click on Color Scale -> Shaded Relief and change the Deg Azimuth field to <tt>315</tt>.


 * 10. Select File -> Save Map Image, and choose <tt>bmp</tt> format for an optimal quality, then save this image, for example with the name <tt>Shadows_315</tt>.




 * 11. Select Color Scale -> Shaded Relief and this time change the Deg Azimuth field value to <tt>275</tt>.  Confirm, then save the image in <tt>BMP</tt> format with the name <tt>Shadows_275</tt>.


 * 12. Change the illumination source again, this time to <tt>355</tt>. Save this third image with the name <tt>Shadows_355</tt>. Close 3DEM.