Wikipedia:Graphics Lab/Resources/QGIS/Shaded reliefs

From Wikipedia, the free encyclopedia
Jump to: navigation, search

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

Many tiles to merge ?[edit]

Formerly, most GIS raster layers were provided through many small tiles to download separately (lighter to download), then to merge together on your computer. However, since 2011, the new NASA downloading system :

take advantage of higher bandwidth and allow the downloading of one heavy tile of the wished size, for ETOPO, SRTM3, Aster, etc.

To merge 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 to merge 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[edit]

Using the plugin "Raster Terrain Analysis plugin" (very good but a bit difficult)(Windows or Linux)[edit]

Crystal Clear app clock-orange.svg In progress Need QGIS 1.8.

According to this recent post and its comments :

> QGIS 1.8 > Raster > Terrain Analysis > Relief (the raster will be relief + shade, unfortunately colors will be discrete and not smooth)

or

> (better)QGIS 1.8 > Raster > Terrain Analysis > Shaded relief (the raster will be only the shade).

It is necessary to enter a number as a "z factor". "z factor" may be 1 or a big number, like 10000 or 100000, in order to make a better relief. So, you have to try different numbers as "z factor". Unfortunately, flat zones won't be transparent, but thanks to z-factor flat zones will be almost insignificant, while shades of mountains will be enough appreciable.

Example for SRTM90, for a zone about 100x100km. Choose z=75000, and 315° azimuth / 75° altitude. Name this layer shaded relief, and in the properties of this layer > transparency > choose band 1 and set the global transparency to approx. 60%.

>> Or follow the tutorials n⁰1 and n⁰2

No more need to editing the file with GIMP ! (or maybe only for a less-weight file, png to jpg for example)

If you really want a full transparency in flat zones, you must use The Gimp after any of these methods. See below.

Using Gdaldem hillshade (very good) (only Linux)[edit]

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 it will look great. ; )

Using the plugin "Shaded relief plugin" (medium) (Windows or Linux)[edit]

Forum page: Using QGis Shaded relief plugin (forum question)
Warning: this way request a lot of memory and failed for middle size tiles.

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.7) > 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.7) > Load your raster-topographic layers (such SRTM) > Select layers you want to work on
QGis (1.7) > 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.

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[edit]

Yes check.svg Done - Done, awaiting testing & your feedbacks !

We can optimize 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 to use Photoshop. The shaded relief and topographic data production are natively strongly oriented toward technical application, sciences, accuracy, and thus towards extreme 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 increases the visible details, while the three others make the information load smaller by reducing details so that the endresult will 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%)[edit]

Reinforce shadows. Play me full screen !
Yes check.svg Done - Done, awaiting testing & your feedbacks !

Concept: Reinforcing contrast, especially shadows. Duplicate the shaded relief layer, make a pixel operation : multiply. Darkest pixels get darker (multiply). while brightest ones 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 click on a layer > right-click on the top layer > Merge down

In this way you reinforce the density of the shadows resulting from this main illumination. Next usual step: see #Whitening.

Composite relief (0%)[edit]

Comparison between an original and a composite relief

Crystal Clear app clock-orange.svg Complement, progress: 0%. Waiting for descritpion of method. 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%)[edit]

Comparison between a composite relief and a composite relief optimised for a small scale map
Yes check.svg Done - Done, awaiting testing & your feedbacks !

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%)[edit]

Yes check.svg Done - Done, awaiting testing & your feedbacks !

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[edit]

  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 click on a layer > right-click on the top layer > Merge down


Color to transparency. Play me full screen !

Grey/White to transparency[edit]

  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", click 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[edit]

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.

Crystal Clear app clock-orange.svg In progress: 0%, waiting its method description, looking for a editor!

See also[edit]

Links[edit]

Gtk-dialog-info.svg

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