Rectifies a raster data file based on the related rational polynomial coefficients (RPC) parameters and returns the updated raster data file.

Syntax

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

Parameters

Parameter Description
rast The raster object to be rectified.
dem A digital elevation model (DEM) that is referenced when this function rectifies the raster object. Default value: null.
rectifyOption The options to be rectified. The value is a JSON-formatted string.
storageOption The storage options for the output. The value is a JSON-formatted string.
parallelOption The parallel options. The value is a JSON-formatted string.

Description

Note The raster object must contain RPC information.

rectifyOption is an array of strings in the JSON format. The following table describes the parameters of each JSON object.

Parameter Description Type Default value Description
resample The method that is used to resample pixels. string 'Near' Valid values:
  • Near
  • Average
  • Cubic
  • Bilinear
outSrid The spatial reference information of the new raster object. integer The value is the same as the value for the original raster object. None
nodataValue The new nodata value that is specified based on the bands of the new raster object. float8

float8[]

NULL You can specify a value or an array in the nodataValue parameter.
  • If you specify a value, the value is used for all bands in the new raster object.
  • If you specify an array [0, 0, 0], the number of array elements must be the same as the number bands in the new raster object.
  • If you do not specify this parameter, the system sets this parameter to the value of the nodataValue parameter for the original raster object. If the original nodataValue parameter is not specified, the system sets this parameter to 0.
RPC_DEM_MISSING_VALUE The height value when the dem parameter is set to the new nodata value or the raster data is not included in the valid values of the dem parameter. float8 0 None

The following table describes the parameters of the storageOption parameter.

Parameter Description Type Default value Description
chunking Specifies whether to store the data as chunks. boolean The value is the same as the value for the original raster object. None
chunkdim The dimensions that are used to chunk data. string The value is the same as the value for the original raster object. This parameter takes effect only when you set the chunking parameter to true.
chunktable The name of the chunk table. string '' If you specify the value '', the system create a temporary chunk table that has a random name in the current session. This chunk table is used to store the new raster object. The temporary chunk table is available only in the current session. After the session ends, the temporary chunk table is also deleted. If you want to save the new raster object, you must specify a name for the chunk table.

If the specified parallel method does not support chunk tables that are created by anonymous users, you must create a chunk table in advance.

compression The format into which you want to compress the data of the raster object. string The value is the same as the value for the original raster object. Valid values:
  • NONE
  • JPEG
  • ZLIB
  • PNG
  • LZO
  • LZ4
  • JP2K
quality The quality of compression. integer The value is the same as the value for the original raster object. This parameter is available only for JPEG and compression algorithms.
interleaving The method that is used to interleave the data of the raster object. string The value is the same as the value for the original raster object. Valid values:
  • bip: band interleaved by pixel (BIP)
  • bil: band interleaved by line (BIL)
  • bsq: band sequential (BSQ)
endian The endian format of the new raster object. string The value is the same as the value for the original raster object. Valid values:
  • NDR: little endian
  • XDR: big endian

Examples:

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

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

-- The 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);

-- The dem parameter is not specified. The system samples data by using the Nearest Neighbor Search (NNS) method.
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;

-- The dem parameter is specified. The system samples data by using the NNS method.
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;