ST_Point
What is ST_Point?
ST_Point is a PostGIS function that constructs a 2D POINT from X and Y coordinates. Since PostGIS 3.2 it accepts an optional SRID argument directly, removing the need to wrap the call in ST_SetSRID.
1ST_Point(float x, float y) → geometry
2ST_Point(float x, float y, integer srid) → geometryPrior to PostGIS 3.2, ST_Point was a two-argument constructor equivalent to ST_MakePoint without SRID. The three-argument form is the recommended modern constructor for 2D points.
When would you use ST_Point?
Use ST_Point whenever you construct a 2D point from numeric coordinates in modern PostGIS code. The SRID argument makes intent explicit and avoids the common ST_MakePoint pitfall of producing SRID 0:
1INSERT INTO events (name, location)
2VALUES ('Station A', ST_Point(-73.98, 40.75, 4326));It is the simplest constructor for building lat/lon points during ETL, ad-hoc distance calculations (ST_DWithin(geom, ST_Point(lon, lat, 4326), 500)), or parameterized queries sent from an application. Remember X first, Y second — longitude before latitude in EPSG:4326.
FAQs
What is the difference between ST_Point and ST_MakePoint?
ST_MakePoint takes 2–4 numeric coordinates and always returns SRID 0. ST_Point (3.2+) takes X, Y, and optional SRID, making ST_Point(lon, lat, 4326) equivalent to ST_SetSRID(ST_MakePoint(lon, lat), 4326). Use ST_Point for 2D, and ST_MakePoint or ST_MakePointM when you need Z or M.
Why are my points showing up in the wrong place?
Coordinate order. ST_Point takes X, Y — longitude, latitude for EPSG:4326. Swapping them is the single most common PostGIS mistake; "Null Island" renders at (0,0) for missing data, and the Atlantic Ocean somewhere off Africa is usually a sign that you flipped lat/lon.
Do I need an index on columns built from ST_Point?
If you query on the resulting geometry, yes — create a GiST index on the geometry column. The SRID argument ensures the constructed point matches the indexed column's SRID so the planner can actually use the index.
What is the difference between ST_Point and ST_PointZ, ST_PointM, ST_PointZM?
ST_Point is 2D. The others (PostGIS 3.2+) construct points with Z, M, or both dimensions, all with explicit SRID arguments. Pick the variant matching the dimensionality of your data.