All Products
Search
Document Center

PolarDB:ST_RPCRectify

Last Updated:Mar 28, 2026

Rectifies a raster object based on rational polynomial coefficients (RPC) parameters and returns the rectified raster.

Syntax

raster ST_RPCRectify(raster rast,
                    raster dem DEFAULT NULL,
                    cstring rectifyOption DEFAULT '{}',
                    cstring storageOption DEFAULT '{}',
                    cstring parallelOption DEFAULT '{}')

Prerequisites

The raster object must contain RPC information.

Parameters

ParameterTypeDefaultDescription
rastrasterThe raster object to rectify.
demrasterNULLA digital elevation model (DEM) referenced during rectification. Default value: NULL.
rectifyOptioncstring'{}'Rectification options as a JSON string.
storageOptioncstring'{}'Output storage options as a JSON string.
parallelOptioncstring'{}'Parallel processing options as a JSON string.

rectifyOption parameters

ParameterTypeDefaultNotes
resamplestring'Near'Resampling method. Valid values: Near, Average, Cubic, Bilinear.
outSridintegerSame as sourceSpatial reference identifier (SRID) for the output raster.
nodataValuefloat8 or float8[]NULLNodata value for the output raster bands. Specify a single value to apply it to all bands, or an array (e.g., [0, 0, 0]) with one element per band. If omitted, the value is inherited from the source raster; if the source has no nodata value, defaults to 0.
RPC_DEM_MISSING_VALUEfloat80Height value used when the DEM has a nodata value at the sample point, or when the sample coordinate falls outside the DEM extent.

storageOption parameters

ParameterTypeDefaultNotes
chunkingbooleanSame as sourceWhether to store the output as chunks.
chunkdimstringSame as sourceChunk dimensions. Takes effect only when chunking is true.
chunktablestring''Name of the chunk table. If set to '', a temporary chunk table with a random name is created for the current session and deleted when the session ends. To persist the output raster, specify a table name. If the parallel method does not support chunk tables created by anonymous users, create the chunk table before calling the function.
compressionstringSame as sourceCompression format. Valid values: NONE, JPEG, ZLIB, PNG, LZO, LZ4, JP2K.
qualityintegerSame as sourceCompression quality. Takes effect only with JPEG compression.
interleavingstringSame as sourceBand interleaving format. Valid values: bip (band interleaved by pixel), bil (band interleaved by line), bsq (band sequential).
endianstringSame as sourceByte order of the output raster. Valid values: NDR (little endian), XDR (big endian).

Examples

The following examples use a table that stores both the source RPC raster and the DEM. Set up the tables first:

CREATE TABLE IF NOT EXISTS raster_table (id integer, rast raster);
CREATE TABLE raster_result (id integer, rast raster);

-- Load the RPC raster data
INSERT INTO raster_table VALUES (1, ST_ImportFrom('t_chunk', '<RAST_DATA_DIR>/rpc.tif', '{}'));

-- Load the DEM data
INSERT INTO raster_table VALUES (2, ST_ImportFrom('t_chunk', '<RAST_DATA_DIR>/rpc_dem.tif', '{}'));

Replace <RAST_DATA_DIR> with the directory path containing your raster files.

Rectify without a DEM

Use nearest neighbor resampling (NNS method) without specifying a DEM:

INSERT INTO raster_result (id, rast)
SELECT 10, ST_RPCRectify(
    rast,
    NULL,
    '{"resample": "Near"}',
    '{"chunking": true, "chunkdim": "(256,256,1)", "interleaving": "bsq", "chunktable": "t_chunk"}'
)
FROM raster_table
WHERE id = 1;

Rectify with a DEM and parallel processing

Use nearest neighbor resampling (NNS method) with a DEM and parallel processing:

INSERT INTO raster_result (id, rast)
SELECT 11, ST_RPCRectify(
    rast,
    (SELECT rast FROM raster_table WHERE id = 2),
    '{"resample": "Near", "outSrid": 32635}',
    '{"chunking": true, "chunkdim": "(256,256,1)", "interleaving": "bsq", "chunktable": "t_chunk"}',
    '{"parallel": 8}'
)
FROM raster_table
WHERE id = 1;