All Products
Search
Document Center

PolarDB:ST_SetScale

Last Updated:Mar 28, 2026

Sets the pixel widths 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 width of the raster object on the X scale in the spatial reference system.
scaleYThe pixel width of the raster object on the Y scale in the spatial reference system.
scaleXYThe pixel width of the raster object on the X and Y scales in the spatial reference system. Use this parameter to set the same scale on both axes.

Example

Set the X scale to 1.3 and the Y scale to 0.6 for the raster object in raster_table where id = 2, 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;

Expected output:

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