Returns the maximum Y coordinate of a raster object.
Syntax
float8 ST_YMax(raster raster_obj)
float8 ST_YMax(raster raster_obj, integer pyramid)Parameters
| Parameter | Description |
|---|---|
raster_obj | The raster whose maximum Y coordinate you want to retrieve. |
pyramid | The pyramid level of the raster. Valid values start from 0. The maximum value depends on the number of pyramid levels in the raster. |
Description
For a georeferenced raster, ST_YMax returns the maximum Y coordinate in the raster's spatial reference system. For a raster that is not georeferenced, it returns the raster height minus 1.
Examples
Non-georeferenced raster
The following example retrieves the maximum Y coordinate from all rasters in raster_table. The output 31 may indicate the raster is not georeferenced — in that case, the function returns the raster height minus 1 instead of a geographic coordinate.
SELECT ST_YMax(rast)
FROM raster_table;Output:
st_ymax
----------
31Georeferenced raster at a specific pyramid level
The following example retrieves the maximum Y coordinate of rasters in georef_table at pyramid level 0. For a georeferenced raster, the function returns a geographic coordinate in the raster's spatial reference system.
SELECT ST_YMax(rast, 0)
FROM georef_table;See also
ST_YMin
ST_XMax
ST_XMin