All Products
Search
Document Center

PolarDB:ST_RPCRectify

Last Updated:Aug 20, 2026

Rectifies a raster based on the RPC (Rational Polynomial Coefficients) parameters of the raster image and returns the rectified raster object.

Syntax

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

Parameters

ParameterDescription
rastThe raster object to be rectified.
demThe DEM raster object used as the reference for rectification. If it is not required, pass in NULL.
rectifyOptionThe rectification options, in JSON string format.
storageOptionThe storage options of the result, in JSON string format.
parallelOptionThe parallel options, in JSON string format.

Description

Note The raster object must contain RPC-related information.

rectifyOptionis a string array in JSON format. Each child JSON object specifies the following parameters:

ParameterDescriptionTypeDefaultRemarks
resampleResampling methodstring'Near'The resampling method of the raster. Only the following methods are supported:
  • Near
  • Average
  • Cubic
  • Bilinear
outSridThe spatial reference of the result rasterintegerSame as the original rasterNone
nodataValueSpecifies a new nodata value for each band.float8

float8[]

NULLThe value of nodataValue can be specified as a single value or an array.
  • If it is specified as a single value, all bands of the output raster object use the same nodata value.
  • If it is specified as an array, such as [0, 0, 0], the number of array elements must be the same as the number of bands of the raster.
  • If it is not specified, the nodata value of the original raster data is used by default. If the original raster has no nodata value, 0 is used as the nodata value.
RPC_DEM_MISSING_VALUEThe elevation value used when the DEM value is nodata or when the raster data is outside the extent of the DEM.float80None

storageOptionparameters are as follows:

ParameterDescriptionTypeDefaultRemarks
chunkingSpecifies whether to use chunked storage.booleanSame as the original rasterNone
chunkdimThe dimension information of the chunks.stringSame as the original rasterThis parameter is valid only when the chunking parameter is set to true.
chunktableThe name of the chunk table.string''If the value '' is passed in, a temporary table with a random name is created in the current session to store the converted raster object. The temporary table is valid only in the current session and is deleted after the session ends. If you want to save the converted raster object, you must specify a concrete table name.

If the parallel method that you use does not support anonymous tables, you must create the table in advance.

compressionThe type of the compression algorithm.stringSame as the original rasterCurrently, only the following types are supported:
  • NONE
  • JPEG
  • ZLIB
  • PNG
  • LZO
  • LZ4
  • JP2K
qualityThe compression quality.integerSame as the original rasterApplies only to the JPEG compression algorithm.
interleavingThe interleaving method.stringSame as the original rasterOnly the following methods are supported:
  • bip:Band interleaved by pixel
  • bil:Band interleaved by line
  • bsq:Band Sequential
endianThe byte order.stringSame as the original rasterOnly the following types are supported:
  • NDR:Little endian
  • XDR:Big endian

Examples

CREATE TABLE if not exists raster_table(id integer, rast raster);

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

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

CREATE TABLE raster_result(id integer, rast raster);

-- Do not specify dem. Use nearest-neighbor sampling.
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;

-- Specify dem. Use nearest-neighbor sampling, set the output srid to 32635, and use parallel computation.
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;