MySQL tutorial: ST_LATITUDE [EN]
top of page
CerebroSQL

MySQL: 

ST_LATITUDE

ST_Latitude(p [, new_latitude_val])

With a single argument representing a valid Point object p that has a
geographic spatial reference system (SRS), ST_Latitude() returns the
latitude value of p as a double-precision number.

With the optional second argument representing a valid latitude value,
ST_Latitude() returns a Point object like the first argument with its
latitude equal to the second argument.

ST_Latitude() handles its arguments as described in the introduction to
this section, with the addition that if the Point object is valid but
does not have a geographic SRS, an ER_SRS_NOT_GEOGRAPHIC
(https://dev.mysql.com/doc/mysql-errors/8.0/en/server-error-reference.h
tml#error_er_srs_not_geographic) error occurs.

URL: https://dev.mysql.com/doc/refman/8.0/en/gis-point-property-functions.html

Example

mysql> SET @pt = ST_GeomFromText('POINT(45 90)', 4326);
mysql> SELECT ST_Latitude(@pt);
+------------------+
| ST_Latitude(@pt) |
+------------------+
| 45 |
+------------------+
mysql> SELECT ST_AsText(ST_Latitude(@pt, 10));
+---------------------------------+
| ST_AsText(ST_Latitude(@pt, 10)) |
+---------------------------------+
| POINT(10 90) |
+---------------------------------+

bottom of page