Jump to content

Wikipedia:Graphics Lab/Resources/QGIS/Shaded reliefs

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Yug (talk | contribs) at 06:32, 15 June 2011 (Bumping (50%)). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

This page introduce how to merge several tiles into one, which is then easier to stylize, and to treat (shaded relief). In also introduce how to create shaded relief through Gdaldem hillshade or the QGis Shaded relief plugin, and the associated GIMP whitening to improve this relief.

Merge tiles

Merge layers is based on their nature : vector or raster. This later ease later application of color style, layer management, and files/project sharing. For raster such as topographic data (SRTM, ETOPO, etc.), shaded relief, natural earth skin, ... use :

QGis (1.6) > Raster > Merge > (merge window pop up)
> Input files : (browse then select your files)
> Output file: (browse then select your folder)
> Load into canvas when finished : (check this)

For vectors layers there is a similar pathway from QGis (1.6) > Vector. However, vector being light, it is usually not necessary to merge them

Last, for vector with raster, vector layers can be converted to raster before to be merged with raster base map, and for raster with vector, raster base map can be converted to vector to be merged with vector layers.

Creating a shaded relief

Using Gdaldem hillshape (best)

On Ubuntu, the install of QGis *seems* to also install Gdaldem hillshape. Its command is:

$ cd /my/folder/with/my_GIS_files/inside/
$ gdaldem hillshade input_dem.ext output_hillshade.ext -z 5 -s 111120 -az 315 -alt 60

The following specific options are available :

-z zFactor:
vertical exaggeration used to pre-multiply the elevations
-s scale:
ratio of vertical units to horizontal. If the horizontal unit of the source DEM is degrees (e.g Lat/Long WGS84 projection), you can use scale=111120 if the vertical units are meters (or scale=370400 if they are in feet)
-az azimuth:
azimuth of the light, in degrees. 0 if it comes from the top of the raster, 90 from the east, ... The default value, 315, should rarely be changed as it is the value generally used to generate shaded maps.
-alt altitude:
altitude of the light, in degrees. 90 if the light comes from above the DEM, 0 if it is raking light.

Then, load into QGis, apply an opacity of 30%, and that look great. ; )

Using the plugin (medium)

Forum page: Using QGis Shaded relief plugin (forum question)

Generate shaded reliefs from QGis, its "Shaded relief" plugin, and SRTM or other topographic files is very easy. So:

Install the "Shaded relief" plugin
QGis (1.6) > Plugins > Fetch Python plugins > (a window pop up)
>>Repositories tab > Add 3rd party repositories
>>Plugins tab > Filter : type "Shaded" > "Shaded relief" plugin appears > select > Install plugin.
Using plugin "Shaded relief"
QGis (1.6) > Load your raster-topographic layers (such SRTM) > Select layers you want to work on
QGis (1.6) > Plugins > Shaded relief > Shaded relief > (a window pop up)
>> Azimut (light): 315⁰ (North-West or leftcorner) Altit sun: 60⁰. Exageration : 0.000009 (bad tips to convert meters to degrees) ; Cell : 0. > ok.

The output files appear within QGis and look ugly. But the final Print Composer output quality depends of the size of your output.

The operation can be applied to a serie of SRTM .tif files by selecting the containing folder.

Optimizing a shaded relief

↑to upgrade to GIMP 2.6, 2011 : rewrite/refind an efficient process and its pathways (), redo screenshot later.

We can optimized the shaded relief in a bitmap editor, either TheGIMP (free), or Photoshop (proprietary). The tutorials below display TheGIMP, but reading them will also help a lot if you plan use Photoshop. The shaded relief and topographic data production are natively strongly oriented toward technical application, sciences, accuracy, and thus toward extrem details. On the other side, the purpose and needs of making maps for Wikipedia and our general public push us to be human friendly, and thus look for graphical lightness and elegance. Thus, out of the 4 operations below: one operation increase visible details, while the three others are making the information load smaller, reducing details, to be more human friendly and... outrageously elegant.

The tools
  • Your shaded relief files: sunlight from 315⁰ (NW), 275⁰, 355⁰.
  • GIMP (2011: 2.6.1): bitmap editor which allows optimization of relief shadows

Reinforce shadows (100%)

Reinforce shadows. Play me full screen !
 Done - Done, awaiting testing !

Concept: Reinforcing contrast, especially shadows. Duplicate the shaded relief layer, make a pixel operation : multiply. Darkest pixels get darker (multiply). while brightest onese almost don't change. (Increase reability).

  1. GIMP > File > (Browse, select, and load your shaded relief image)
  2. GIMP > Layer > Duplicate layer (Ctrl+Shift+D)
  3. GIMP > "Layers, Channels, Paths,..." window > Layer tab > Mode : multiply (on layer on the top of the list of layers)
  4. GIMP > "Layers, Channels, Paths,..." window > Layer tab > right clic on a layer > right-clic on the top layer > Merge down

Thus you reinforce the density of the shadows resulting from this main illumination. Next usual step, see #Whitening.

Composite relief (0%)

Comparison between an original and a composite relief
Comparison between an original and a composite relief

 Complement, progress: 0%, waiting its method description, looking for an editor! Concept: Combine shaded reliefs with different sunlight orientation to avoid blind spot. You will merge 3 shaded relief layers with 315⁰ (NW sunlight, default layer), +355⁰ layer, +275⁰ sunlights, respectively. (Increase details, accuracy)

Bumping (100%)

Comparison between a composite relief and a composite relief optimised for a small scale map
Comparison between a composite relief and a composite relief optimised for a small scale map

 Progress: 100%. New screenshoots welcome. Concept: Combine a lower precision reliefs (use lower sources or blur it) with a hight quality one, so the major feature appears more compare to the usual overload of small details. ("Avoid chartjunk/overload").

  1. GIMP > open shaded relief NAME.ext >
  2. GIMP > Image > Scale image > Check pixel size, Resize to 20% of its size > Save as NAME-20%.ext
  3. GIMP > open NAME-20%.ext > Image > Scale image > Resize to former pixel size (exact pixel size)
  4. QGis or Inkscape > open both layers > Opacity 50% to each
Also to try out: GIMP > Filters > Map > Map bumping


Whitening (100%)

 Done - Done, awaiting testing !

Concept: make the shaded relief whiter, or better transparent, so only the shadows appear. Make lighter background ("Avoid chartjunk/overload").
Specifics: Work on RGB files only. When opening the .tif file in GIMP, the landmass appear grey, northwest sides of hills appear white, while hills' south east side (shadow) appear black. With some programs (gdaldem hillshade), water bodies also appear black, creating confusing and difficulties for the graphist. We want to make white-softgrey (and black waters bodies -only-) transparents. We want to keep the darkgrey-black reliefs.

Whitening: color to white. Play me full screen !
Grey to white
  1. GIMP > Load your shaded relief image (....shaded.tif : are grayscale)
    or a screenshoot of your shaded relief (screenshot : RGB colors)
  2. GIMP > Tool box > Color picker tool [o] > pick up grey pixels in a plain or in water
  3. GIMP > Layer > New layer (Ctrl+Shift+N) > Layer type : •Foreground color : a new grey layer should now hide your topographic data
  4. GIMP > "Layers, Channels, Paths,..." window > Layer tab > Mode : divide (on this grey layer on the top of the list of layers)
  5. GIMP > "Layers, Channels, Paths,..." window > Layer tab > right clic on a layer > right-clic on the top layer > Merge down


Color to transparency. Play me full screen !
Grey to transparency
  1. GIMP 2.6 > Load your shaded relief image (....shaded.tif : are grayscale)
    or a screenshoot of your shaded relief (screenshot : RGB colors)
  2. Force it to be RGB: Gimp > Image > Mode > RGB, click.
  3. Delete the grey : Colors > "color to alpha" pop up > uncheck "preview", clic on the horizontal color rectangle > "Color to alpha color picker" pop up> bottom right corner, click on the icon eyes dropper > choice you color of to delete (some grey pixel in a flat plain) > validate.
  4. Delete an other color (white, black background) > same.
  5. File > save as > ProjectName_relief_whitened.png (to keep transparency)


Black waters to transparency

You risk to also delete black shadows. You may prefer to simply later and conveniently hide black water by one of the widely available water's vector layers.

 In progress: 0%, waiting its method description, looking for a editor!

The table above has links to various tutorials and resources which can help in the creation of Wikipedia maps from digital georeferenced data (GIS).