13.13 SDO_GEOR_UTL.generateColorRamp

Format

SDO_GEOR_UTL.generateColorRamp(
     colorSeeds     IN SDO_GEOR_COLORMAP, 
     rampSteps      IN SDO_NUMBER_ARRAY, 
     cellValueType  IN VARCHAR2 DEFAULT 'integer', 
     interpoParam   IN VARCHAR2 DEFAULT 'method=linear' 
     ) RETURN SDO_GEOR_COLORMAP;

Description

Generates an SDO_GEOR_COLORMAP object with a color ramp (gradient) by interpolating the red, green, blue, and alpha values entered as seed.

Parameters

colorSeeds

An SDO_GEOR_COLORMAP object with the seed values to be used as the beginning and end values for the interpolation. Should contain at least two groups, each containing a pixel value and set of RGBA values. (RGBA = red, green, blue, alpha)

rampSteps

An array where each item indicates how many interpolated values will be generated for each section of the color ramp. Should contain at least one integer value indicating how many values will be generated for each section.

cellValueType

A string indicating whether the cell values should be creates as integer or real values. The possible values for this parameter are integer (the default) or real.

interpoParam

A string specifying the interpolation method. The possible values are method=linear (the default) and method=cosine.

Usage Notes

This function returns an object of type SDO_GEOR_COLORMAP, which is described in SDO_GEOR_COLORMAP Object Type.

A color ramp can have several different sections with different lengths for each section. If colorSeeds specifies three RGBA values, the function will generate two sections on the same color ramp. The number of color levels for each section is controlled by rampSteps array. The total number of the colors in the generated colormap is the sum of the values in the rampSteps array and the number of colors in the input colormap seed. To generate independent sections, insert a new item in the colorSeeds parameter, and a new item in rampSteps. (Any value of 0 in rampSteps indicates that no interpolated values are needed to generate in that section.)

Examples

The following example generates and applies a color ramp containing 256 colors interpolated linearly from green to red. (It assumes the existence of a table named RAMP_TEST containing at least columns named ID and RASTER.)

DECLARE
  gr sdo_georaster;
  cmp sdo_geor_colormap;
BEGIN
  select raster into gr from ramp_test where id = 1 for update;

  cmp := sdo_geor_utl.generateColorRamp(   
            colorSeeds => sdo_geor_colormap(
              sdo_number_array(   1,1000),
              sdo_number_array(   0, 255),
              sdo_number_array( 255,   0),
              sdo_number_array(   0,   0),
              sdo_number_array( 255, 255)),
            rampSteps  => sdo_number_array( 254 ),
            cellValueType => 'integer',
            interpoParam  => 'method=linear' );

  sdo_geor.setColorMap( gr, 0, cmp );

  update ramp_test set raster = gr where id = 1;
  commit;
END;

The following example generates and applies a color ramp that goes from shades of green turning into blue and from blue turning into red. (It assumes the existence of a table named RAMP_TEST containing at least columns named ID and RASTER.) The two sections will share the second item from the colorSeeds parameter value, the blue color.

DECLARE
  gr sdo_georaster;
  cmp sdo_geor_colormap;
BEGIN
  select raster into gr from ramp_test where id = 1 for update;

  cmp := sdo_geor_utl.generateColorRamp(   
            colorSeeds => sdo_geor_colormap(
              sdo_number_array(   1, 500, 1000),
              sdo_number_array(   0,   0,  255),
              sdo_number_array( 255,   0,    0),
              sdo_number_array(   0, 255,    0),
              sdo_number_array( 255, 255,  255)),
            rampSteps  => sdo_number_array( 126, 127 ),
            cellValueType => 'integer',
            interpoParam  => 'method=linear' );

  sdo_geor.setColorMap( gr, 0, cmp );

  update ramp_test set raster = gr where id = 1;
  commit;
END;

The following example generates a color ramp of 256 items with a section that goes from green to blue and a section that goes from white to red. (It assumes the existence of a table named RAMP_TEST containing at least columns named ID and RASTER.)

DECLARE
  gr sdo_georaster;
  cmp sdo_geor_colormap;
BEGIN
  select raster into gr from ramp_test where id = 1 for update;

  cmp := sdo_geor_utl.generateColorRamp(   
            colorSeeds => sdo_geor_colormap(
              sdo_number_array(   1, 500,  500, 1000),
              sdo_number_array(   0,   0,  255,  255),
              sdo_number_array( 255,   0,  255,    0),
              sdo_number_array(   0, 255,  255,    0),
              sdo_number_array( 255, 255,  255,  255)),
            rampSteps  => sdo_number_array( 126, 0, 126 ),
            cellValueType => 'integer',
            interpoParam  => 'method=linear' );

  sdo_geor.setColorMap( gr, 0, cmp );

  update ramp_test set raster = gr where id = 1;
  commit;
END;

The value of 0 in the rampSteps array (rampSteps => sdo_number_array( 126, 0, 126 );) indicates that no interpolated values are needed for generation in the second section.