Functions / PostGIS / ST_PointZM
PostGISGeometry Constructors

ST_PointZM

What is ST_PointZM?

ST_PointZM is a PostGIS function (added in 3.2) that constructs a 4D POINT ZM with X, Y, Z, and M coordinates and an explicit SRID. It is the complete-dimension modern constructor, equivalent to ST_SetSRID(ST_MakePoint(x, y, z, m), srid).

SQL
ST_PointZM(float x, float y, float z, float m, integer srid)geometry

Use when both elevation (Z) and measure (M) are meaningful for your dataset — such as a 3D route where M represents distance travelled and Z represents altitude.

When would you use ST_PointZM?

Use ST_PointZM for datasets that need both elevation and measure — drone flight logs where Z is altitude and M is flight time, 3D pipelines where Z is depth and M is chainage, or vehicle telemetry where Z is road grade and M is odometer reading:

SQL
1INSERT INTO drone_track (flight_id, geom)
2SELECT flight_id,
3       ST_PointZM(lon, lat, alt_m, EXTRACT(EPOCH FROM t), 4326)
4FROM drone_log
5ORDER BY t;

The points can then be aggregated into a LINESTRING ZM using ST_MakeLine, preserving all four dimensions for downstream 3D and linear-referencing analysis.

FAQs

What is the difference between ST_PointZM and ST_MakePoint with four arguments?

Structurally identical output, but ST_MakePoint(x, y, z, m) returns SRID 0 — you must wrap in ST_SetSRID. ST_PointZM takes the SRID inline, which is cleaner and less error-prone.

Do standard predicates honor Z or M?

No. 2D predicates (ST_Intersects, ST_DWithin) ignore Z and M. Use ST_3D* variants for Z-aware distance or intersection; use linear-referencing functions (ST_LocateAlong, ST_AddMeasure) for M-aware processing.

Which PostGIS version is required?

ST_PointZM with an SRID argument is PostGIS 3.2+. On earlier versions use the ST_SetSRID(ST_MakePoint(...), srid) pattern.

How do I read the Z and M values back?

Use the accessors ST_Z(point) and ST_M(point). They return NULL if the dimension is absent.