All Products
Search
Document Center

PolarDB:ST_SetScale

Last Updated:Mar 28, 2026

Sets the pixel size of a raster object on the X and Y scales in the spatial reference system.

Syntax

raster ST_SetScale(raster raster_obj, float8 scaleX, float8 scaleY)
raster ST_SetScale(raster raster_obj, float8 scaleXY)

Parameters

ParameterDescription
raster_objThe raster object to update.
scaleXThe pixel size on the X scale in the spatial reference system.
scaleYThe pixel size on the Y scale in the spatial reference system.
scaleXYThe pixel size on both the X and Y scales in the spatial reference system. Both scales are set to the same value.

Examples

Set different scale values on the X and Y scales, then verify the result:

UPDATE raster_table
SET rast = ST_SetScale(rast, 1.3, 0.6)
WHERE id = 2;

SELECT st_scalex(rast), st_scaley(rast)
FROM raster_table
WHERE id = 2;

Output:

 st_scalex | st_scaley
-----------+-----------
       1.3 |       0.6