7.33 SDO_GEOR.georeference

Format (procedure)

SDO_GEOR.georeference(
     georaster                IN OUT SDO_GEORASTER, 
     srid                     IN NUMBER, 
     modelCoordinateLocation  IN NUMBER, 
     xCoefficients            IN SDO_NUMBER_ARRAY, 
     yCoefficients            IN SDO_NUMBER_ARRAY);

Format (function)

SDO_GEOR.georeference(
     georaster               IN OUT SDO_GEORASTER, 
     FFMethodType            IN VARCHAR2, 
     nGCP                    IN NUMBER, 
     GCPs                    IN SDO_GEOR_GCP_COLLECTION, 
     storeGCP                IN VARCHAR2 DEFAULT 'TRUE', 
     srid                    IN NUMBER DEFAULT NULL, 
     modelCoordinateLocation IN NUMBER DEFAULT NULL, 
     setResolution           IN VARCHAR2 DEFAULT NULL 
     ) RETURN SDO_NUMBER_ARRAY;

or

SDO_GEOR.georeference(
     georaster               IN OUT SDO_GEORASTER, 
     gcpGeorefModel          IN SDO_GEOR_GCPGEOREFTYPE, 
     storeGCP                IN VARCHAR2 DEFAULT 'TRUE', 
     srid                    IN NUMBER DEFAULT NULL, 
     modelCoordinateLocation IN NUMBER DEFAULT NULL,    
     setResolution           IN VARCHAR2 DEFAULT NULL 
     ) RETURN SDO_NUMBER_ARRAY;

or

SDO_GEOR.georeference(
     georaster               IN OUT SDO_GEORASTER, 
     FFMethodType            IN VARCHAR2 DEFAULT NULL, 
     srid                    IN NUMBER DEFAULT NULL, 
     modelCoordinateLocation IN NUMBER DEFAULT NULL, 
     setResolution           IN VARCHAR2 DEFAULT NULL 
     ) RETURN SDO_NUMBER_ARRAY;

Description

As a procedure, georeferences a GeoRaster object using specified cell-to-model transformation coefficients of an affine transformation. As a function, returns the solution of any one of the supported geometric models using ground control points (GCPs) that are either stored in the database or specified in parameters.

Parameters

georaster

The SDO_GEORASTER object to be georeferenced.

srid

Model coordinate system. For the procedure, must not be null or 0 (zero); for function, it can be null. It can be a value from the SRID column of the MDSYS.CS_SRS table. If it is not a value from the SRID column of the MDSYS.CS_SRS table, the SRID is not supported by Oracle Spatial, and some SRID-related operations may not be supported.

modelCoordinateLocation

A value specifying the model location of the base of the area represented by a cell: 0 for CENTER or 1 for UPPERLEFT.

xCoefficients

An array specifying the A, B, and C coefficient values in the calculation, as explained in the Usage Notes.

yCoefficients

An array specifying the D, E, and F coefficient values in the calculation, as explained in the Usage Notes.

FFMethodType

Polynomial or rational polynomial function used as georeference geometric model. Must be one of the following string values: Affine, QuadraticPolynomial, CubicPolynomial, DLT, QuadraticRational, or RPC.

gcpGeorefModel

Object containing the following: FFMethodType, nGCP, GCPs, solutionAccuracy.

nGCP

Number of ground control points in the GCP collection (GCPs parameter).

GCPs

The GCP collection, of type SDO_GEOR_GCP_COLLECTION (described in SDO_GEOR_GCP_ COLLECTION Collection Type).

storeGCP

A flag indicating whether the GCPs should be stored in the GeoRaster metadata. The string TRUE (the default) stores the points in the GeoRaster metadata; the string FALSE does not store the points in the GeoRaster metadata.

setResolution

A flag indicating whether the spatial resolution is calculated and stored in the GeoRaster metadata. The string FALSE or a null value does not store the spatial resolution in the GeoRaster metadata; the string TRUE stores the spatial resolution in the GeoRaster metadata.

Usage Notes

Notes for the Procedure Format

Use this procedure to georeference a GeoRaster object based on an existing affine transformation. Georeferencing is explained in Georeferencing and Georeferencing GeoRaster Objects.

This procedure assumes that in the original georeferencing information in the source data, such as in an ESRI world file, the transformation formulas are the following:

x = A * column + B * row + C
y = D * column + E * row + F

Specify the preceding A, B, C, D, E, and F coefficients to the SDO_GEOR.georeference procedure. They are automatically adjusted internally to produce the correct georeferencing result: a, b, c, d, e, and f coefficients, as in the following formulas:

row    = a + b * x + c * y
column = d + e * x + f * y

In these formulas:

  • row = Row index of the cell in raster space.

  • column = Column index of the cell in raster space.

  • x = East-West position of the point on the ground or in model space.

  • y = North-South position of the point on the ground or in model space.

  • a, b, c, d, e, and f are coefficients, and they are stored in the GeoRaster SRS metadata.

  • b*f – c*e should not be equal to 0 (zero).

In these formulas, if b = 0, f = 0, c = -e, and both c and e are not 0 (zero), the raster data is called rectified, and the formula becomes:

row    = a + c * y
column = d - c * x

This procedure sets the spatial resolutions of the GeoRaster object.

The following also perform operations related to georeferencing:

Notes for the Function Formats (for Use with GCPs)

This function calculates the solution of the specified geometric model (the FFMethodType) using the GCPs that are either stored in the database or specified in parameters, and it stores the solution in the GeoRaster functional fitting model.

The returned array contains RMS values and residuals, which have the following order: the solution accuracy (rowRMS, colRMS, totalRMS) computed using control points, the ground positioning accuracy (xRMS, yRMS, zRMS, modelTotalRMS) computed using check points, the ground positioning accuracy (xRMS, yRMS, zRMS, modelTotalRMS) computed using control points, and the (xResidual, yResidual) for each control point (not for check points). The ordering of the residuals is the same as the control points stored in the XML metadata (not necessarily in the sequential order of the control point ID values if the ID values are numbers).

There are always at least 17 values returned (assuming at least 3 control points). A positioning accuracy (RMS) value of –1.0 means that value does not exist. For a two-dimensional geometric model, the zRMS value is always –1.0; otherwise, zRMS values are always 0 in the current release.

The GCPs can either be retrieved from the GeoRaster metadata or provided using the GCP-related object types.

For the interface without GCP information (that is, the format without the gcpGeorefModel parameter), the GCPs are assumed to be stored in the GeoRaster object's metadata. If no GCPs are stored or if not enough GCPs are stored for the specified model, an exception is raised.

After this function call, the GeoRaster object is georeferenced and the coefficients of the functional fitting model are set in the GeoRaster SRS metadata component.

For more information about georeferencing using GCPs, see Ground Control Point (GCP) Georeferencing Model.

Examples

The following example georeferences a GeoRaster object directly using the cell-to-model coefficients of an affine transformation. (It refers to a table named GEORASTER_TABLE, whose definition is presented after Example 1-1 in Storage Parameters.)

DECLARE
  gr sdo_georaster;
BEGIN
  SELECT georaster INTO gr FROM georaster_table WHERE georid = 1 FOR UPDATE;
  sdo_geor.georeference(gr, 82394, 0,
                        sdo_number_array(28.5, 0, 1232804.04),
                        sdo_number_array(0, -28.5, 13678.09));
  UPDATE georaster_table SET georaster = gr WHERE georid = 1;
  COMMIT;
END;
/
 
PL/SQL procedure successfully completed.
 
SET NUMWIDTH 20
SELECT georid, sdo_geor.getSRS(georaster) SRS FROM georaster_table
  WHERE georid = 1;
 
              GEORID
--------------------
SRS(ISREFERENCED, ISRECTIFIED, ISORTHORECTIFIED, SRID,
SPATIALRESOLUTION, SPATIA
--------------------------------------------------------------------------------
 
                   1
SDO_GEOR_SRS('TRUE', 'TRUE', NULL, 82394, SDO_NUMBER_ARRAY(28.5, 28.5), NULL, NU
LL, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, NULL, NULL, NULL, SDO_NUMBER_ARRAY(1, 2, 1, 3,
 479.93298245614, 0, -.0350877192982456), SDO_NUMBER_ARRAY(1, 0, 0, 1, 1), SDO_N
UMBER_ARRAY(1, 2, 1, 3, -43256.2821052632, .0350877192982456, 0), SDO_NUMBER_ARR
AY(1, 0, 0, 1, 1))

If the original raster data is rectified and if the model coordinate of the center point of the upper-left corner cell is (x0, y0) and its spatial resolution is s, you can directly use the preceding example code to georeference the GeoRaster object by replacing 28.5 with s, 1232804.04 with x0, and 13678.09 with y0. If you have other information about the GeoRaster object, such as a well-defined precise envelope of the raster or the model coordinates of the center point, you can compute the (x0, y0) and the spatial resolution s, and then use the same approach to georeference the object.

The following example georeferences a GeoRaster object, using ground control point (GCP) information.

DECLARE
   gr1                 sdo_georaster;
   gr2                  sdo_georaster;
   georefModel   SDO_GEOR_GCPGEOREFTYPE;
   GCPs              SDO_GEOR_GCP_COLLECTION;
   rms                  sdo_number_array;
BEGIN
   SELECT georaster INTO gr1 from georaster_table WHERE georid=10 FOR UPDATE;
 
   GCPs := SDO_GEOR_GCP_COLLECTION( 
                           SDO_GEOR_GCP('1', '', 1, 
                              2, sdo_number_array(25.625000, 73.875000),
                              2, sdo_number_array(237036.937500, 897987.187500),
                              NULL, NULL),
                              SDO_GEOR_GCP('2', '', 1, 
                              2, sdo_number_array(100.625000, 459.125000),
                              2, sdo_number_array(237229.562500, 897949.687500),
                              NULL, NULL),
                              SDO_GEOR_GCP('3', '', 1, 
                              2, sdo_number_array(362.375000, 77.875000),
                              2, sdo_number_array(237038.937500, 897818.812500),
                              NULL, NULL),
                              SDO_GEOR_GCP('4', '', 1, 
                              2, sdo_number_array(478.875000, 402.125000),
                              2, sdo_number_array(237201.062500, 897760.562500),
                              NULL, NULL),
                              SDO_GEOR_GCP('5', '', 2, 
                              2, sdo_number_array(167.470583,  64.030686),
                              2, sdo_number_array(237032.015343, 897916.264708),
                              NULL, NULL),
                              SDO_GEOR_GCP('6', '', 2, 
                              2, sdo_number_array(101.456177,  257.915534),
                              2, sdo_number_array(237128.957767, 897949.271912),
                              NULL, NULL)
                       );
 
   georefModel := SDO_GEOR_GCPGEOREFTYPE('Affine',
GCPs.count, GCPs, NULL);
 
   rms := sdo_geor.georeference(gr1, georefModel, 'FALSE', 26986, 1);
   UPDATE georaster_table SET georaster=gr1 WHERE georid=10;
   COMMIT;
END;
/