The ST_M() function

The ST_M() function returns the measure value of a point.

Syntax

ST_M(p1 ST_Point)

Return type

DOUBLE PRECISION

Example

The m_test table is created with the gid INTEGER column, which uniquely identifies the row, and the pt1 ST_Point column that stores the sample geometry:
CREATE TABLE m_test (gid integer,
                     pt1 ST_Point);
The following INSERT statements insert a point with measures and a point without measures:
INSERT INTO m_test VALUES( 
   1, 
   ST_PointFromText('point (10.02 20.01)', 1000) 
);

INSERT INTO m_test VALUES( 
   2, 
   ST_PointFromText('point zm (10.02 20.01 5.0 7.0)', 1000) 
);
In this query, the ST_M() function lists the measure values of the points. Because the first point does not have measures, the ST_M() function returns NULL:
SELECT gid, ST_M(pt1) The_measure
   FROM m_test;

        gid    the_measure 

          1               
          2 7.000000000000