ST_Y

Return the Y coordinate of a POINT geometry.

Category: geospatialReturns: DOUBLEDialect: Standard

Syntax

ST_Y(point)

Description

## Overview Returns the Y ordinate of a POINT geometry as a DOUBLE. For geographic data Y corresponds to latitude in decimal degrees. The Y value represents north/south position: negative values are south of the equator, positive values are north. ST_Y is the inverse of the second argument of ST_MAKE_POINT. Together with ST_X it round-trips a POINT geometry back into its two numeric coordinates. ## When to use ST_Y vs. alternatives - **ST_Y** (this function): extract the Y (latitude) coordinate from a POINT. - **ST_X**: extract the X (longitude) coordinate from a POINT. - **ST_AS_TEXT**: serialize the entire geometry as WKT when both coordinates are needed. - **Direct column access**: if the table already stores lat and lng as separate DOUBLE columns, use those directly. ## Behavior - Returns a DOUBLE. - Works only on POINT geometries. LINESTRING, POLYGON, or multi-geometries raise an error or return NULL depending on runtime mode; reduce to a POINT first. - Returns NULL if the input geometry is NULL. - The value is the raw Y ordinate stored in the geometry; no CRS transformation is performed. - On an empty POINT, behavior is implementation-defined; prefer filtering empties explicitly. ## Input format - Accepts any POINT built with ST_MAKE_POINT, parsed with ST_GEOM_FROM_TEXT, or returned by other ST_ functions that produce a POINT. - The caller is responsible for tracking whether Y means latitude, northing, or something else entirely based on the CRS of the input. ## Compatibility - Matches the OGC Simple Features ST_Y semantics for 2D POINT geometries. - Returns the raw ordinate value with no unit conversion, matching other SQL engines that expose ST_Y.

Parameters

NameTypeDescription
pointSpecifies a POINT geometry whose Y coordinate to extract. For geographic data Y is latitude in decimal degrees. Non-POINT inputs raise an error or return NULL depending on runtime mode.

Examples

-- Y is latitude for geographic data; expect 40.7128.
SELECT ST_Y(ST_MAKE_POINT(-74.0060, 40.7128)) AS lat;
-- WKT coordinate order is (x y), so the second number is Y.
SELECT ST_Y(ST_GEOM_FROM_TEXT('POINT(2.3522 48.8566)')) AS lat;
-- Denormalize a POINT column for downstream tooling.
SELECT id,
       ST_X(geom) AS lng,
       ST_Y(geom) AS lat
FROM geo.catalog.poi;
-- Y > 0 selects everything north of the equator.
SELECT id
FROM geo.catalog.poi
WHERE ST_Y(geom) > 0;
-- Group rows by integer latitude bands.
SELECT CAST(FLOOR(ST_Y(geom)) AS INT) AS lat_band, COUNT(*) AS n
FROM geo.catalog.poi
GROUP BY lat_band
ORDER BY lat_band;
-- Rebuild the point from its coordinates.
SELECT ST_MAKE_POINT(ST_X(geom), ST_Y(geom)) AS geom2
FROM geo.catalog.poi;

Pitfalls

See Also

Open in interactive docs →   DeltaForge home →