Functions / PostGIS / ST_Y
PostGISGeometry Accessors

ST_Y

What is ST_Y?

ST_Y is a PostGIS function that returns the Y coordinate of a POINT geometry. For lat/lon data (EPSG:4326), Y is latitude.

SQL
ST_Y(geometry point)double precision

Input must be a single POINT. Non-point input returns NULL.

When would you use ST_Y?

Use ST_Y (paired with ST_X) to pull out latitude/Y values for export, display, or downstream arithmetic:

SQL
1SELECT id,
2       ST_X(geom) AS lon,
3       ST_Y(geom) AS lat
4FROM sites;

Also common in latitude-band filters (WHERE ST_Y(geom) BETWEEN 40 AND 41) when you want the arithmetic clarity without the spatial-index complexity of ST_MakeEnvelope.

FAQs

Is ST_Y latitude or longitude for EPSG:4326?

Latitude. Y = north-south. Combined with X = longitude.

What does ST_Y return for non-Point input?

NULL. Extract a vertex first with ST_Centroid, ST_StartPoint, etc.

How do I filter by latitude band efficiently?

For small bands, ST_Y(geom) BETWEEN a AND b works but is not index-accelerated. For large tables use a bounding-box predicate: geom && ST_MakeEnvelope(-180, a, 180, b, 4326).

Does ST_Y support geography?

Yes — there is a geography overload that returns the Y (latitude) component.