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
| Parameter | Description |
| rast | The raster object to be rectified. |
| dem | The DEM raster object used as the reference for rectification. If it is not required, pass in NULL. |
| rectifyOption | The rectification options, in JSON string format. |
| storageOption | The storage options of the result, in JSON string format. |
| parallelOption | The 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:
| Parameter | Description | Type | Default | Remarks |
| resample | Resampling method | string | 'Near' | The resampling method of the raster. Only the following methods are supported:
|
| outSrid | The spatial reference of the result raster | integer | Same as the original raster | None |
| nodataValue | Specifies a new nodata value for each band. | float8 float8[] | NULL | The value of nodataValue can be specified as a single value or an array.
|
| RPC_DEM_MISSING_VALUE | The elevation value used when the DEM value is nodata or when the raster data is outside the extent of the DEM. | float8 | 0 | None |
storageOptionparameters are as follows:
| Parameter | Description | Type | Default | Remarks |
| chunking | Specifies whether to use chunked storage. | boolean | Same as the original raster | None |
| chunkdim | The dimension information of the chunks. | string | Same as the original raster | This parameter is valid only when the chunking parameter is set to true. |
| chunktable | The 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. |
| compression | The type of the compression algorithm. | string | Same as the original raster | Currently, only the following types are supported:
|
| quality | The compression quality. | integer | Same as the original raster | Applies only to the JPEG compression algorithm. |
| interleaving | The interleaving method. | string | Same as the original raster | Only the following methods are supported:
|
| endian | The byte order. | string | Same as the original raster | Only the following types are supported:
|
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;