5.10 Cartographic Modeling

Raster algebra is widely used in cartographic modeling and is considered an essential component of GIS systems. Using the PL/SQL and the raster algebra expressions and functions, you can conduct cartographic modeling over a large number of rasters and images of virtually unlimited size.

For example, a cartographic modeling process for wildfire evaluation might retrieve the elevation, slope, aspect, temperature, wetness, and other information from a series of raster layers and then evaluate the cells one-by-one to create a resulting raster map, which can be further classified to create a thematic map. Change analysis, site selection, suitability analysis, climate modeling, and oil field evaluation using the raster layer overlay technique are other typical cartographic modeling processes. In those cases, arithmetic, relational, and logical operations may need to be combined.

Assume that a hypothetical cartographic model involves seven different raster layers and has an expression as follows. and that the modeling result is a raster map with 0 and 1 as cell values:

output = 1 if ( (100 < layer1 <= 500) 
                & (layer2 == 3 or layer2 == 10) 
                & ( (layer3+layer4) * log(Layer5) / sqrt(layer5) ) >= layer6) 
                || (layer7 != 1) ) 
                is TRUE and
         0 if otherwise

Example 5-24 shows how to run the preceding cartographic model in GeoRaster and store the result as a bitmap.

Example 5-24 Cartographic Modeling

DECLARE 
  geor       SDO_GEORASTER;
  geor1      SDO_GEORASTER;
  mycursor   sys_refcursor;
  expr       varchar2(1024);
BEGIN
  --7 source GeoRaster objects, each of which contains one source layer in the order of 1 to 7
  OPEN mycursor FOR
    select georaster from georaster_table where georid >0 and georid <=7 order by georid;
  --Output GeoRaster object to contain the result
  insert into georaster_table (georid, georaster) values (8, sdo_geor.init('RDT_1',8))
    returning georaster into geor1;
  --Modeling using arithmeticExpr, booleanExpr, and rasterMathOp 
  expr := 
   'condition(
         ( (100<{0,0}) & ({0,0}<=500) )
           & ( ({1,0}=3) | ({1,0}=10) )
           & ( ( ( ({2,0}+{3,0}) * log({4,0} ) / sqrt({4,0}) ) >= {5,0} ) | ({6,0}!=1) 
         ),
         1,
         0)';
  sdo_geor_ra.rasterMathOp(mycursor, sdo_string2_array(expr), 
                           'celldepth=1BIT', geor1, 'true', 0, 'parallel=4');
  update georaster_table set georaster = geor1 where georid = 8;
  commit;
END;
/

The process in Example 5-24 considers NODATA and will assign 0 (zero) to any cell that is a NODATA cell in one or more source layers. It is also parallelized into four processes to leverage multiple CPUs of the database server to improve performance.