ST_M

Definition

ST_M takes an ST_Point as an input parameter and returns its measure (m) coordinate.

In SQLite, ST_M can also be used to update a measure value.

Syntax

Oracle and PostgreSQL

sde.st_m (point1 sde.st_point)

SQLite

st_m (point1 geometryblob)
st_m (point1 geometryblob, new_Mvalue double)

Return type

Oracle and PostgreSQL

Number

SQLite

Double precision if querying for a measure value; a geometryblob if updating a measure value

Examples

Oracle

The table, m_test, is created and three points inserted to it. All three contain measure values. A SELECT statement is run with the ST_M function to return the measure value for each point.

CREATE TABLE m_test (
 id integer,
 geometry sde.st_point);

INSERT INTO M_TEST VALUES (
 1,
 sde.st_point (2, 3, 32, 5, 4322)
);

INSERT INTO M_TEST VALUES (
 2,
 sde.st_point (4, 5, 20, 4, 4326)
);

INSERT INTO M_TEST VALUES (
 3,
 sde.st_point (3, 8, 23, 7, 4326)
);

SELECT id, sde.st_m (geometry) M_COORD
 FROM M_TEST; 

        ID    M_COORD

         1          5
         2          4
         3          7

PostgreSQL

The table, m_test, is created and three points inserted to it. All three contain measure values. A SELECT statement is run with the ST_M function to return the measure value for each point.

CREATE TABLE m_test (
 id serial,
 geometry sde.st_point
);

INSERT INTO m_test (geometry) VALUES (
 sde.st_point (2, 3, 32, 5, 4326)
);

INSERT INTO m_test (geometry) VALUES (
 sde.st_point (4, 5, 20, 4, 4326)
);

INSERT INTO m_test (geometry) VALUES (
 sde.st_point (3, 8, 23, 7, 4326)
);

SELECT id, sde.st_m (geometry) 
 AS M_COORD
 FROM m_test; 

        id    m_coord

         1          5
         2          4
         3          7

SQLite

In the first example, the table, m_test, is created and three points inserted to it. All three contain measure values. A SELECT statement is run with the ST_M function to return the measure value for each point.

CREATE TABLE m_test (
 id integer primary key autoincrement not null
);

SELECT AddGeometryColumn (
 NULL,
 'm_test',
 'geometry',
 4326,
 'pointzm',
 'xyzm',
 'null'
);

INSERT INTO m_test (geometry) VALUES (
 st_point (2, 3, 32, 5, 4326)
);

INSERT INTO m_test (geometry) VALUES (
 st_point (4, 5, 20, 4, 4326)
);

INSERT INTO m_test (geometry) VALUES (
 st_point (3, 8, 23, 7, 4326)
);

SELECT id, st_m (geometry) 
 AS M_COORD
 FROM m_test; 

id    m_coord

1     5.0
2     4.0
3     7.0

In this second example, the measure value is updated for record 3 in the m_test table.

SELECT st_m (geometry, 7.5)
 FROM m_test
 WHERE id = 3;

Related Topics

6/19/2015