Elevation Zoning Scenario

This example combines rasters of two types -  a numeric DEM raster and color RGB raster (don't forget the worldfile). Besides, it shows how to bring the rasters to the same size in pixels - otherwise the RasterExpressionEvaluator won't work.

The workspace demonstrates an elevation zoning scenario. Depending on values in the DEM and zoning interval (zone height), it creates two to four different zones - low, average, high, and very high elevations and shows them on a road map taken from Google Maps.

The resulting map can help you choose the right vehicle - if you live in the red zone, in winter you will need four wheel drive or at least new tires, in the green zone you should be fine even with old tires.

DEM Road Map

User-added image

User-added image

Elevation Zoning
User-added image

After the two rasters have been brought to the same size (see workspace comments), RasterExpressionEvaluators start their job.

In the first expression transformer. the road map is changed to have a grayscale look, although we still need it in RGB interpretation for two reasons - first, we want to see zones in color, and second - the map looks nicer when the ocean is left blue:

if(A[0]==153 && A[1]==179 && A[2]==204, A[0], 0.2989*A[0] + 0.5870*A[1] + 0.1140*A[2]);
if(A[0]==153 && A[1]==179 && A[2]==204, A[1], 0.2989*A[0] + 0.5870*A[1] + 0.1140*A[2]);
if(A[0]==153 && A[1]==179 && A[2]==204, A[2], 0.2989*A[0] + 0.5870*A[1] + 0.1140*A[2])


The second RasterExpressionEvaluator classifies the DEM. It also uses an attribute, _height, which can be changed from its default value (50 meters) to any integer value in the range between 20 to 100 meters. Press Ctrl+R in order to change this parameter.

if(A[0]==0,0,A[0]/A:_height+1)


The last ExpressionEvaluator changes the red and green bands of the A raster (road map) according to a zone number stored in raster B (classified DEM). The higher the elevation, the more red we add. Green is boosted for lower elevation zones:

if(B[0]<=2,A[0], if(B[0]==3 || B[0]==4, A[0]*1.1, if(B[0]==5 || B[0]==6, A[0]*1.3, A[0]*1.5)));
if(B[0]==0 || B[0]==5 || B[0]==6, A[1], if(B[0]==1 || B[0]==2,A[1]*1.3, if(B[0]>=7, A[1]/1.1, A[1]*1.1)));
A[2]
  • See attachment: elevationZoning.fmwt