The ST_Y() function
The ST_Y() function returns the Y coordinate of a point.
Syntax
ST_Y(p1 ST_Point)
Return type
DOUBLE PRECISION
Example
The y_test table is created
with two columns: gid, which uniquely identifies the row, and
the pt1 point column:
CREATE TABLE y_test (gid integer,
pt1 ST_Point);
The following
INSERT statements insert two rows. One is a point without a Z coordinate
or a measure. The other has both a Z coordinate and a measure:
INSERT INTO y_test VALUES(
1,
ST_PointFromText('point (10.02 20.01)', 1000)
);
INSERT INTO y_test VALUES(
2,
ST_PointFromText('point zm (10.02 20.01 5.0 7.0)',1000)
);
The query retrieves the values in the gid column
and the DOUBLE PRECISION Y coordinate of the points:
SELECT gid, ST_Y(pt1) y_coord
FROM y_test;
gid y_coord
1 20.01000000000
2 20.01000000000