You can create CartoType maps (CTM1 files) containing array objects. These are effectively textures in computer graphics terms: that is, they are rectangular bitmaps which can be projected on to the map and rendered in various ways.

The most common standard layers created in CTM1 files by the tool generate_map_data_type1 are called terrain-shadow and terrain-height-feet.

Terrain shading using the terrain-shadow layer

The terrain-shadow layer contains an eight-bit opacity (alpha) value for each sample, representing the light intensity for a simulated sun in the south-west. You draw it like this, giving a color value to be used when drawing the shadow. You can provide an opacity value as well. For example:

<layer name='terrain-shadow'>
<shape fill='#446' opacity='0.75'/>

gives light greyish-green terrain shading.

Terrain height coloring using the terrain-height-feet layer

The terrain-height-feet layer contains an eight-bit height value for each sample, using values that represent round numbers of feet. The height encoding is as follows. The values 1 ... 195 represent the heights -1500 feet ... 18,000 feet, in steps of 100 feet. The values 196 ... 255 represent the heights 18,200 feet to 30,000 feet, in steps of 200 feet. Thus the whole range of land heights present on Earth is represented. The value 0 is used for points for which no data is available.

You can draw terrain heights as colors, either blending them smoothly or using a fixed color over a range of heights. CartoType uses the SVG gradient syntax, with some enhancements: in particular, there is a <range> element, specifying a fixed color over a <range>, as well as <stop>; and the unit ft-height makes it easy to specify heights in feet directly.

The best way to explain is by example. In the <defs> section of a CartoType style sheet there is a ramp gradient definition:

<rampGradient id="terrain-feet-height-ramp">
   <stop offset='100ft-height' color='darkseagreen'/>
   <stop offset='600ft-height' color='palegreen'/>
   <stop offset='1200ft-height' color='palegoldenrod'/>
   <stop offset='3000ft-height' color='burlywood'/>
   <stop offset='4500ft-height' color='lightsalmon'/>
   <stop offset='6000ft-height' color='grey'/>
   <stop offset='9000ft-height' color='white'/>
   <stop offset='12000ft-height' color='cornflowerblue'/>
   <stop offset='18000ft-height' color='azure'/>
   <stop offset='30000ft-height' color='white'/>
   <range start='0' end='1' color='#00000000'/>
   <range start='1' end='100ft-height' color='darkseagreen'/>

and in the main part of the style sheet the terrain-height-feet layer is drawn like this:

<layer name='terrain-height-feet'>
   <shape fill='url(#terrain-feet-height-ramp)'/>

Note that the height code 0, meaning no data is available, is not drawn, because its color is completely transparent (color='#00000000').

Style Sheets Directory