Cartographic Shaded Relief

Banded hypsometric tinting

This example colours elevation in 7 discrete colour bands with a fine contour line between each band.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Draws a shaded relief map with banded hypsometric colours and contours
version(1.0);

# Change the directory below to correspond to your file location.
baseDir = "c:/Program Files/LandSerf/data/landscriptExamples/";

# Open raster DEM and create seven elevation bands.
dem = open(baseDir&"dem.srf");
minHeight = info(dem,"min");
range = info(dem,"max")-minHeight;
inc = range/7;

# Provide a discrete colour for each band.
colouredit(dem,"rules", minHeight &       " 141 166 141 (D)," &
                        minHeight+ 1*inc & " 172 194 155 (D)," &
                        minHeight+ 2*inc & " 221 219 167 (D)," &        
                        minHeight+ 3*inc & " 254 235 181 (D)," &
                        minHeight+ 4*inc & " 248 212 153 (D)," &
                        minHeight+ 5*inc & " 241 170 109 (D)," &
                        minHeight+ 6*inc & " 227 112  72 (D)");

# Create contours at boundries of the bands.
contours = contour(dem,minHeight+(inc/2),inc,1);
colouredit(contours,"rules","0 50 10 0");
vectorstyle("linewidth",0.1);

# Combine contours, relief and hypsometric tinting.
draw(baseDir&"dem.png",dem,dem,contours,"null","relief");
dem.png:
dem.png

Cold and warm shaded relief

This script uses phong shaded relief to create two relief maps of a DEM with a blue (cold) light slightly clockwise of NW and a yellow (warm) light slightly anticlockwise. The 'warm' relief is calculated at a coarse scale to emphasise the larger scale features in the DEM (lines 22-30). The two images are then blended and saved as file (line 33).

Contours are threaded through the DEM at 100m vertical interval (line 37) and coloured a transparent brown (line38).

Finally, the relief map is blended with the original coloured DEM with the contours overlaid to produce the final output.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Draws cartographic shaded relief map of a DEM with contours.
version(1.0);

# Change the directory below to correspond to your file location.
baseDir = "c:/Program Files/LandSerf/data/landscriptExamples/";

# Open raster DEM.
dem = open(baseDir&"dem.srf");

# Set phong shading parameters
edit(dem,"specular",70);
edit(dem,"diffuse",50);
edit(dem,"ambient",30);

# Sun shining between W and NW 
# with a 30 deg. divergence between warm and cold light directions.
sunAzim = 292.5;
sunDeviation = 30;
coldSize = 3;
warmSize = 25;

# Cold light clockwise of main sun azimuth
edit(dem,"sunAzim",(sunAzim+sunDeviation)%360);
relief1 = surfparam(dem,"shade",coldSize,1);
colouredit(relief1,"rules","0 0 0 0, 1 127 127 255");

# Warm light anticlockwise of main sun azimuth
edit(dem,"sunAzim",(sunAzim-sunDeviation)%360);
relief2 = surfparam(dem,"shade",warmSize,1);
colouredit(relief2,"rules","0 0 0 0, 1 255 255 127");
 
# Blend the warm and cold images
draw(baseDir&"relief.png",relief1,relief2,"null","null","blend",50);

# Create contours from original DEM
minHeight = round(info(dem,"min")/10)*10;
contours = contour(dem,minHeight,100,1);
colouredit(contours,"rules","0 50 10 0 100");
vectorstyle("linewidth",0.1);

# Combine contours, relief and hypsometric tinting.
relief = open(baseDir&"relief.png","image");
draw(baseDir&"dem.png",dem,relief,contours,"null","blend",30);
relief.png:
Relief

dem.png:
Final output