ST_Longitude()¶
TL;DR¶
Use ST_Longitude() to obtain the first coordinate of a point.
Returns a point’s longitude coordinate.
Syntax¶
ST_Longitude(point)
Arguments¶
Argument |
Description |
|---|---|
|
A POINT |
Return Value¶
Returns FLOAT64 for GEOMETRY and FLOAT32 for GEOMETRY32.
Usage Notes¶
The tested point input is
POINT(3 4), for which longitude is the first coordinate.
Examples¶
DROP DATABASE IF EXISTS geo_longitude_demo;
CREATE DATABASE geo_longitude_demo;
USE geo_longitude_demo;
SELECT ST_Longitude(ST_GeomFromText('POINT(3 4)')) AS longitude;
DROP DATABASE geo_longitude_demo;