ST_SetScale

更新时间:
复制 MD 格式

Sets the pixel width of a raster object along the X and Y 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

ParameterDescription
raster_objThe raster object to update.
scaleXThe pixel width along the X axis in the spatial reference system.
scaleYThe pixel width along the Y axis in the spatial reference system.
scaleXYThe pixel width along both the X and Y axes in the spatial reference system. Use this parameter to set equal pixel widths on both axes.

Examples

Update the scale of a raster object and 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