Documentation Home
MySQL 5.7 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 35.1Mb
PDF (A4) - 35.2Mb
Man Pages (TGZ) - 256.4Kb
Man Pages (Zip) - 361.2Kb
Info (Gzip) - 3.4Mb
Info (Zip) - 3.4Mb
Excerpts from this Manual

MySQL 5.7 Reference Manual  / ...  / Functions and Operators  / Spatial Analysis Functions  /  MySQL-Specific Functions That Create Geometry Values

12.16.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.

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 isNULL.

For example, you can insert the geometry return value fromPoint() directly into aPOINT column:

INSERT INTO t1 (pt_col) VALUES(Point(1,2));
  • GeometryCollection(g [,g] ...)

    Constructs aGeometryCollection value from the geometry arguments.

    GeometryCollection() returns all the proper geometries contained in the arguments even if a nonsupported geometry is present.

    GeometryCollection() with no arguments is permitted as a way to create an empty geometry.

  • LineString(pt [,pt] ...)

    Constructs aLineString value from a number ofPoint or WKBPoint arguments. If the number of arguments is less than two, the return value isNULL.

  • MultiLineString(ls [,ls] ...)

    Constructs aMultiLineString value usingLineString or WKBLineString arguments.

  • MultiPoint(pt [,pt2] ...)

    Constructs aMultiPoint value usingPoint or WKBPoint arguments.

  • MultiPolygon(poly [,poly] ...)

    Constructs aMultiPolygon value from a set ofPolygon or WKBPolygon arguments.

  • Point(x,y)

    Constructs aPoint using its coordinates.

  • Polygon(ls [,ls] ...)

    Constructs aPolygon value from a number ofLineString or WKBLineString arguments. If any argument does not represent aLinearRing (that is, not a closed and simpleLineString), the return value isNULL.