Sets the pixel width of a raster object along the X axis, the Y axis, or both axes 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
| Parameter | Data type | Description |
|---|---|---|
| raster_obj | raster | The raster object. |
| scaleX | float8 | The pixel width along the X axis in the spatial reference system. |
| scaleY | float8 | The pixel width along the Y axis in the spatial reference system. |
| scaleXY | float8 | The pixel width along both the X and Y axes in the spatial reference system. Use this parameter to set equal scale on both axes. |
Examples
The following example sets the X scale to 1.3 and the Y scale to 0.6 on the raster object in row id = 2, then queries the result to verify the update.
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