7.151 SDO_GEOR.setStatistics

Format

SDO_GEOR.setStatistics(
     georaster    IN OUT SDO_GEORASTER, 
     layerNumber  IN NUMBER, 
     statistics   IN SDO_NUMBER_ARRAY);

or

SDO_GEOR.setStatistics(
     georaster      IN OUT SDO_GEORASTER, 
     layerNumber    IN NUMBER, 
     statistics     IN SDO_NUMBER_ARRAY, 
     histogram      IN SDO_GEOR_HISTOGRAM, 
     samplingFactor IN NUMBER DEFAULT 1, 
     samplingWindow IN SDO_NUMBER_ARRAY DEFAULT NULL);

or

SDO_GEOR.setStatistics(
     georaster      IN OUT SDO_GEORASTER, 
     layerNumber    IN NUMBER, 
     statistics     IN SDO_NUMBER_ARRAY, 
     histogramTable IN VARCHAR2, 
     samplingFactor IN NUMBER DEFAULT NULL, 
     samplingWindow IN SDO_NUMBER_ARRAY DEFAULT NULL);

Description

Sets statistical data associated with a layer.

Parameters

georaster

GeoRaster object.

layerNumber

Number of the layer for which to set the statistics. A value of 0 (zero) indicates the object layer.

statistics

An array with the following numeric values: MIN, MAX, MEAN, MEDIAN, MODEVALUE, STD. You must specify non-null values for all values in the array. The SDO_NUMBER_ARRAY type is defined as VARRAY(1048576) OF NUMBER.

If this parameter is null, all statistical information associated with the layer is deleted.

histogram

Histogram of type SDO_GEOR_HISTOGRAM. SDO_GEOR_HISTOGRAM Object Type describes this object type and briefly discusses histograms.

histogramTable

The name of the table that stores the histogram.

samplingFactor

Sampling factor. The denominator n in 1/n, representing the number of cells sampled in computing the statistics. For example, if samplingFactor is 4, one-fourth of the cells were sampled. The default is 1; that is, all cells were sampled. The higher the value, the less accurate the statistics are likely to be, but the more quickly they were computed.

samplingWindow

Sampling window: a rectangular window for which to set statistics, specified either as a numeric array with the lower-left and upper-right coordinates or as an SDO_GEOMETRY object. The SDO_NUMBER_ARRAY type is defined as VARRAY(1048576) OF NUMBER. The window must be inside the extent in cell space. The default for this parameter is the entire image.

Usage Notes

This procedure sets statistical data described by the <statisticDatasetType> element in the GeoRaster metadata XML schema, which is described in GeoRaster Metadata XML Schema.

If histogram is specified as null, and if there is an existing histogram and you set the statistics using a different sampling factor or sampling window, the existing histogram is removed.

Contrast this procedure, in which you specify the statistics to be set, with the SDO_GEOR.generateStatistics function, which causes GeoRaster to compute and set the statistics.

To retrieve the statistical data associated with a layer, use the SDO_GEOR.getStatistics function.

An exception is raised if layerNumber is null or invalid for the GeoRaster object, or if statistics is of the wrong array size or has any null array elements.

Examples

The following example sets the statistical data for layer 0 of the GeoRaster object (GEORASTER column) in the row with the GEORID column value of 4 in the GEORASTER_TABLE table. (The GEORASTER_TABLE table definition is presented after Example 1-1 in Storage Parameters.)

DECLARE
  grobj sdo_georaster;
BEGIN
  SELECT georaster INTO grobj FROM georaster_table WHERE georid=4 FOR UPDATE;
  sdo_geor.setStatistics(grobj, 0, SDO_NUMBER_ARRAY(0, 255, 100, 127, 95, 25));
  UPDATE georaster_table SET georaster = grobj WHERE georid=4;
  COMMIT;
END;
/