5.11 Terrain Modeling and Analysis

You can use the data from input GeoRaster objects to perform terrain modeling and analysis.

The SDO_GEOR_GDAL.dem procedure uses the data from an input GeoRaster object to generate output based on the specified processing parameter. The input GeoRaster object is usually a Digital Elevation Model, and the processing values could be a value such as hillshade, slope, aspect, color-relief, or roughness.

Example 5-25 Hillshade

If the processing parameter value is hillshade the procedue generates a grayscale image that represent the shadows of the elevated areas over the adjacent areas, mimicking the visual effect of sunlight.

This example creates a hillshade image.

DECLARE
  gr1 sdo_georaster;
  gr2 sdo_georaster;
BEGIN
  select raster into gr1 from imagery where id = 1;
  delete from imagery where id = 2;
  insert into imagery values(2, sdo_geor.init('imagery_rdt',2))
         returning raster into gr2;
  sdo_geor_gdal.dem(gr1, gr2, 'hillshade');
  update imagery set raster = gr2 where id = 2;
  commit;
END;
/

Example 5-26 Slope

The procedure can generate a slope or aspect raster based on the elevation values of an input raster. In that case the output pixel values does not produce a visual appealing output, but a useful raster surface that might be used for land use and land allocation analyses. For example, it could be used to define areas good for wine production based on the slope and the angle of exposure to the sun (aspect).

The following example creates a raster representing the slope generated from raster elevation data. The resulting pixel values will be represented in percentage, instead of the default degree output.

DECLARE
  gr1 sdo_georaster;
  gr3 sdo_georaster;
BEGIN
  select raster into gr1 from imagery where id = 1;
  delete from imagery where id = 3;
  insert into imagery values(3, sdo_geor.init('imagery_rdt', 3))
         returning raster into gr3;
  sdo_geor_gdal.dem(gr1, gr3, 'slope', 'slopevalue=percent');
  update imagery set raster = gr3 where id = 3;
  commit;
END;
/

Example 5-27 Aspect

This example creates a raster representing the aspect o generated from raster elevation data. The pixel representing flat areas will have the value 0 instead of the default -9999.

DECLARE
  gr1 sdo_georaster;
  gr4 sdo_georaster;
BEGIN
  select raster into gr1 from imagery where id = 1;
  delete from imagery where id = 4;
  insert into imagery values(4, sdo_geor.init('imagery_rdt', 4))
         returning raster into gr4;
  sdo_geor_gdal.dem(gr1, gr4, 'aspect', 'zeroforflat=yes');
  update imagery set raster = gr4 where id = 4;
  commit;
END;
/

Example 5-28 Color-relief

This example creates a raster representing the color-relief generated from raster elevation data using the file colorfile.txt. For this example, the colorfile.txt file contains the following "elevation-percent red green blue" values

0%  180   0 255
10%  70   0 255
20%   0  70 255
30%   0 180 255
40%   0 255 180
50%   0 255  70
60%  70 255   0
70% 180 255   0
80% 255 180   0
90% 255  70   0
nv    0   0   0
DECLARE
  gr1 sdo_georaster;
  gr5 sdo_georaster;
BEGIN
  select raster into gr1 from imagery where id = 1;
  delete from imagery where id = 5;
  insert into imagery values(5, sdo_geor.init('imagery_rdt', 5))
         returning raster into gr5;
  sdo_geor_gdal.dem(inGeoRaster    => gr1,
                    outGeoRaster   => gr5, 
                    processing     => 'color-relief', 
                    colorDirectory => 'mydir’,
                    colorFilename  => 'colorfile.txt');
  update imagery set raster = gr5 where id = 5;
  commit;
END;
/

In addition to the operations shown in these examples, you can use the procedure to generate Terrain Ruggedness Index (TRI) maps, Topographic Position Index (TPI) maps, and roughness maps from DEM GeoRaster objects.