MariaDB MPointFromText(): WKT and SRID Examples
Build a MariaDB MULTIPOINT from WKT with MPointFromText(), inspect its SRID, and understand why assigning an SRID does not transform coordinates.
On this page
MariaDB’s MPointFromText() constructs a MULTIPOINT geometry from its Well-Known Text (WKT) representation and an optional SRID. MultiPointFromText() is a synonym. See the MariaDB MPointFromText() reference.
Syntax
MPointFromText(wkt[, srid])
wktis a WKT value that describes aMULTIPOINT.sridis an optional integer stored with the geometry.
Create a MULTIPOINT from WKT
The WKT contains one coordinate pair for each point:
SELECT ST_AsText(
MPointFromText('MULTIPOINT(1 1, 2 2, 3 3)')
) AS wkt;
ST_AsText() converts the resulting geometry back to readable WKT. MariaDB also provides MultiPointFromText() for the same WKT input. Do not confuse these functions with MultiPoint(point1, point2, ...), which constructs a MULTIPOINT from WKB POINT values.
Set and inspect the SRID
Pass the SRID when creating the geometry, then inspect both the WKT and the stored SRID:
SET @points = MPointFromText(
'MULTIPOINT(1 1, 2 2, 3 3)',
4326
);
SELECT
ST_AsText(@points) AS wkt,
ST_SRID(@points) AS srid;
Use the SRID that describes the source coordinates. In MariaDB, an SRID is an integer associated with the geometry; assigning 4326 does not transform coordinates. MariaDB’s spatial calculations use Euclidean (planar) geometry, so an SRID value alone does not make distance or area calculations geodesic. See the ST_SRID() reference.
Store the geometry in a table
CREATE TABLE location_sets (
id INT PRIMARY KEY,
locations MULTIPOINT NOT NULL
);
INSERT INTO location_sets (id, locations)
VALUES (
1,
MPointFromText('MULTIPOINT(1 1, 2 2, 3 3)', 4326)
);
SELECT id, ST_AsText(locations), ST_SRID(locations)
FROM location_sets;
For other MariaDB WKT constructors and aliases, see the WKT function reference.