ST_Y
Returns the Y coordinate of a Point geometry.
Syntax
ST_Y(geometry)
Parameters
| Parameter | Type | Description |
|---|---|---|
| geometry | Geometry | Point geometry |
Returns
| Type | Description |
|---|---|
| Float64 | Y coordinate value |
Examples
Get Y Coordinate
SELECT ST_Y(ST_Point(10.5, 20.3));
-- Returns: 20.3
Extract Coordinates from Points
SELECT id, ST_X(geom) as longitude, ST_Y(geom) as latitude
FROM locations;
Filter by Y Range
SELECT * FROM points
WHERE ST_Y(geom) BETWEEN 37.0 AND 38.0;
Calculate Distance from Equator
SELECT id, ABS(ST_Y(geom)) as distance_from_equator
FROM cities;
Notes
- Only valid for Point geometries
- For geographic data, Y typically represents latitude
- Returns NULL if geometry is not a Point
- Works with both GeoArrow Point and WKB Point formats
See Also
- ST_X - Get X coordinate
- ST_Point - Create point from coordinates
- ST_Centroid - Get center point