All Products
Search
Document Center

AnalyticDB:ST_XMax

Last Updated:Mar 28, 2026

Returns the maximum X coordinate of a georeferenced raster object. If the raster has not been georeferenced, the function returns -1, indicating that no geographic reference information is available.

Syntax

float8 ST_XMax(raster raster_obj)
float8 ST_XMax(raster raster_obj, integer pyramid)

Parameters

ParameterDescription
raster_objThe raster object whose maximum X coordinate you want to retrieve.
pyramidThe pyramid level at which to evaluate the raster. Valid values start from 0.

Examples

Basic usage — retrieve the maximum X coordinate from all rows in a raster table:

SELECT ST_XMax(rast)
FROM raster_table;

 st_xmax
----------
      121

With pyramid level — retrieve the maximum X coordinate at a specific pyramid level:

SELECT ST_XMax(rast, 2)
FROM raster_table;

See also

Use ST_XMax together with the following functions to retrieve the full geographic extent of a raster object:

  • ST_XMin: Returns the minimum X coordinate.

  • ST_YMax: Returns the maximum Y coordinate.

  • ST_YMin: Returns the minimum Y coordinate.