4. Geospatial Data Types : Three-dimensional Data Types : LinestringZ and LinestringM Data Types
 
Share this page                  
LinestringZ and LinestringM Data Types
LinestringZ and LinestringM have the same properties as Linestring but with one additional ordinate. LinestringZ adds an elevation ordinate, LinestringM adds a measurement ordinate.
Examples:
Without specifying SRID:
CREATE TABLE trails (name VARCHAR(30), path LINESTRINGZ);
CREATE TABLE roads (name VARCHAR(30), road LINESTRINGM);
With specifying SRID:
CREATE TABLE trails (name VARCHAR(30), path LINESTRINGZ SRID 4326);
CREATE TABLE roads (name VARCHAR(30), road LINESTRINGM SRID 4326);
Use linestrings to represent the path that slopes downward:
CREATE TABLE paths (id INTEGER PRIMARY KEY, path LINESTRINGZ NOT NULL);
INSERT INTO paths (id, path) VALUES (1, GEOMFROMTEXT('LINESTRINGZ(0 0 20, 10 0 10, 10 10 -10)'));
Use linestrings to represent a road with measurement markers.
CREATE TABLE roads (id INTEGER PRIMARY KEY, road LINESTRINGM NOT NULL);
INSERT INTO roads (id, road) VALUES (1, GEOMFROMTEXT('LINESTRINGM(0 0 0, 10 0 20, 10 10 -40)'));