Creating Geometry Values Using MySQL-Specific Functions
MySQL provides a set of useful nonstandard functions for creating geometry values. The functions described in this section are MariaDB extensions to the OpenGIS specification.
These functions produce geometry objects from either WKB values or geometry objects as arguments. If any argument is not a proper WKB or geometry representation of the proper object type, the return value is NULL.
For example, you can insert the geometry return value from Point() directly into a Point column:
INSERT INTO t1 (pt_col) VALUES(Point(1,2));
GeometryCollection(g1,g2,...)Constructs a
GeometryCollection.LineString(pt1,pt2,...)Constructs a
LineStringvalue from a number ofPointor WKBPointarguments. If the number of arguments is less than two, the return value isNULL.MultiLineString(ls1,ls2,...)Constructs a
MultiLineStringvalue usingLineStringor WKBLineStringarguments.MultiPoint(pt1,pt2,...)Constructs a
MultiPointvalue usingPointor WKBPointarguments.MultiPolygon(poly1,poly2,...)Constructs a
MultiPolygonvalue from a set ofPolygonor WKBPolygonarguments.Point(x,y)Constructs a
Pointusing its coordinates.Polygon(ls1,ls2,...)Constructs a
Polygonvalue from a number ofLineStringor WKBLineStringarguments. If any argument does not represent aLinearRing(that is, not a closed and simpleLineString), the return value isNULL.