12.15.5 MySQL-Specific Functions That Create Geometry Values

MySQL provides a set of useful nonstandard functions for creating geometry values. The functions described in this section are MySQL extensions to the OpenGIS specification.

As of MySQL 5.1.35, 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.

Before MySQL 5.1.35, these functions produce BLOB values containing WKB representations of geometry values with no SRID from WKB arguments. The WKB value returned from these functions can be converted to geometry arguments by using them as the first argument to functions in the GeomFromWKB() function family.

For example, as of MySQL 5.1.35, you can insert the geometry return value from Point() directly into a POINT column:

INSERT INTO t1 (pt_col) VALUES(Point(1,2));

Prior to MySQL 5.1.35, convert the WKB return value to a Point before inserting it:

INSERT INTO t1 (pt_col) VALUES(GeomFromWKB(Point(1,2)));