All Products
Search
Document Center

ApsaraDB RDS:ST_InterpolateRaster

Last Updated:Mar 28, 2026

Performs spatial interpolation based on a set of 3D points and returns the result as a new raster object. A 3D point is expressed in the (x,y,z) format.

Syntax

raster ST_InterpolateRaster(
    geometry input_points,
    integer width,
    integer height,
    cstring interpolateOptions,
    cstring storageOptions);

Parameters

ParameterDescription
input_pointsThe set of interpolation points.
widthThe number of columns of the raster data.
heightThe number of rows of the raster data.
interpolateOptionsThe JSON string that describes the spatial interpolation algorithm settings.
storageOptionThe JSON string that describes the chunks for storing the raster object.

The following table describes the fields of the interpolateOptions parameter.

FieldDescriptionTypeDefault valueConfiguration
methodThe interpolation method.stringIDWOnly Inverse Distance Weighting (IDW) interpolation is supported.
radiusThe search radius.double0.0If the value is 0, the search radius is calculated based on the number of input points and the area.
powerThe interpolation weight.double2.0None.
max_pointsThe maximum number of points.integer10Must be greater than the value of the min_points field.
min_pointsThe minimum number of points.integer2None.
nodataThe nodata value.double0.0None.
parallelThe degree of parallelism (DOP).integer1None.

The following table describes the fields of the storageOption parameter.

FieldDescriptionTypeFormatDefault valueNotes
chunkdimThe size of each chunk.string(w, h, b)Same as the size of each chunk in the original object.None.
chunktableThe name of the chunk table.stringNone.None.If this field is not specified, a temporary table is created.
celltypeThe pixel type of the raster object.stringNone.16BUIValid values: 8BSI, 8BUI, 16BSI, 16BUI, 32BSI, 32BUI, 32BF, 64BF.

Examples

The following example uses ST_Collect to aggregate 3D points from point_table and interpolates them into a 256×256 raster using IDW with a search radius of 3.0.

SELECT ST_InterpolateRaster(
  st_collect(ST_MakePoint(st_x(geom),st_y(geom),value)),
  256,
  256,
  '{"method":"IDW","radius":"3.0","max_points":"4","min_points":"1"}',
  '{"chunktable":"rbt","celltype":"8bui"}')
FROM point_table;

st_interpolateraster
---------------------
{"attributes":{"id":"f54cff0a-cca4-4e51-ac11-7aa5a3c9d9b6","name":"","type":"normal","version":1.1,"storage":{"mode":"internal","location":"rbt","md5":"","endian":"ndr","compress":"lz4","compressQuality":75,"fileSystem":"null","chunking":{"enable":true,"chunkHeight":256,"chunkWidth":256,"chunkBand":1,"rowChunksDimension":1,"columnChunksDimension":1,"bandChunksDimension":1},"cellType":"8bui","interleaving":"bsq"},"description":"","width":256,"height":256,"bands":1,"pyramid":{"resample":"near","level":0,"table":""},"overview":{"table":"","column":"","pyramidLevel":1},"referenceOriginPoint":{"type":"Raster","ulp":{"row":0,"column":0,"band":0},"rrp":{"row":0,"column":0,"band":0},"wrp":{"x":0,"y":0,"z":0}}},"spatialReference":{"valid":true,"srid":0,"refLocation":"center","affline":{"upperleftx":0.0,"upperlefty":2.0,"scalex":0.0078125,"scaley":-0.0078125,"skewx":0.0,"skewy":0.0},"gcps":{"count":0}}}

The following example sets parallel to 4 to enable parallel interpolation with a degree of parallelism (DOP) of 4.

SELECT ST_InterpolateRaster(
  st_collect(ST_MakePoint(st_x(geom),st_y(geom),value)),
  256,
  256,
  '{"radius":"2.0","max_points":"4","min_points":"1","parallel":"4"}',
  '{"chunktable":"rbt","celltype":"8bui"}')
FROM point_table;

st_interpolateraster
---------------------
{"attributes":{"id":"b769c306-4416-4e31-9e60-d2b847642190","name":"","type":"normal","version":1.1,"storage":{"mode":"internal","location":"rbt","md5":"","endian":"ndr","compress":"lz4","compressQuality":75,"fileSystem":"null","chunking":{"enable":true,"chunkHeight":256,"chunkWidth":256,"chunkBand":1,"rowChunksDimension":1,"columnChunksDimension":1,"bandChunksDimension":1},"cellType":"8bui","interleaving":"bsq"},"description":"","width":256,"height":256,"bands":1,"pyramid":{"resample":"near","level":0,"table":""},"overview":{"table":"","column":"","pyramidLevel":1},"referenceOriginPoint":{"type":"Raster","ulp":{"row":0,"column":0,"band":0},"rrp":{"row":0,"column":0,"band":0},"wrp":{"x":0,"y":0,"z":0}}},"spatialReference":{"valid":true,"srid":0,"refLocation":"center","affline":{"upperleftx":0.0,"upperlefty":2.0,"scalex":0.0078125,"scaley":-0.0078125,"skewx":0.0,"skewy":0.0},"gcps":{"count":0}}}