All Products
Search
Document Center

PolarDB:ST_PixelWidth

Last Updated:Mar 28, 2026

Returns the pixel width of a raster object in the spatial reference system as a float8 value. When the raster has no skew, the pixel width equals the X scale.

Syntax

float8 ST_PixelWidth(raster raster_obj)

Parameters

ParameterDescription
raster_objThe raster object to query.

How it works

The pixel width is the length of one pixel measured along the X axis in the units of the spatial reference system. The red segment in the figure below illustrates this measurement.

ST_PixelWidth

No skew (common case): When skewX = 0, the pixel width equals the X scale — the straightforward ratio between geometric coordinates and raster pixels.

Examples

Rasters with no skew

Query the pixel width and pixel height together to confirm the resolution:

SELECT st_pixelwidth(rast), st_pixelheight(rast)
FROM raster_table;
 st_pixelwidth | st_pixelheight
---------------+----------------
            60 |             60

Both values are 60, which equals the X scale when there is no skew.