Categories:

Geospatial Functions

ST_Y

Returns the latitude (Y coordinate) of a point.

Syntax

ST_Y( <geography_expression> )

Arguments

geography_expression

The argument must be expression that of type GEOGRAPHY and that contains a Point.

Returns

Returns a REAL value.

Usage Notes

  • Issues an error if the argument is not a Point.

Examples

This shows a simple use of the ST_X and ST_Y functions with VARCHAR data:

SELECT ST_X(ST_MAKEPOINT(37.5, 45.5)), ST_Y(ST_MAKEPOINT(37.5, 45.5));
+--------------------------------+--------------------------------+
| ST_X(ST_MAKEPOINT(37.5, 45.5)) | ST_Y(ST_MAKEPOINT(37.5, 45.5)) |
|--------------------------------+--------------------------------|
|                           37.5 |                           45.5 |
+--------------------------------+--------------------------------+

This shows use of the ST_X and ST_Y functions with NULL values:

SELECT
    ST_X(ST_MAKEPOINT(NULL, NULL)), ST_X(NULL),
    ST_Y(ST_MAKEPOINT(NULL, NULL)), ST_Y(NULL)
    ;
+--------------------------------+------------+--------------------------------+------------+
| ST_X(ST_MAKEPOINT(NULL, NULL)) | ST_X(NULL) | ST_Y(ST_MAKEPOINT(NULL, NULL)) | ST_Y(NULL) |
|--------------------------------+------------+--------------------------------+------------|
|                           NULL |       NULL |                           NULL |       NULL |
+--------------------------------+------------+--------------------------------+------------+