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

12.16.7.1 General Geometry Property Functions

The functions listed in this section do not restrict their argument and accept a geometry value of any type.

  • Dimension(g)

    ST_Dimension() andDimension() are synonyms. For more information, see the description ofST_Dimension().

    Dimension() is deprecated; expect it to be removed in a future MySQL release. UseST_Dimension() instead.

  • Envelope(g)

    ST_Envelope() andEnvelope() are synonyms. For more information, see the description ofST_Envelope().

    Envelope() is deprecated; expect it to be removed in a future MySQL release. UseST_Envelope() instead.

  • GeometryType(g)

    ST_GeometryType() andGeometryType() are synonyms. For more information, see the description ofST_GeometryType().

    GeometryType() is deprecated; expect it to be removed in a future MySQL release. UseST_GeometryType() instead.

  • IsEmpty(g)

    ST_IsEmpty() andIsEmpty() are synonyms. For more information, see the description ofST_IsEmpty().

    IsEmpty() is deprecated; expect it to be removed in a future MySQL release. UseST_IsEmpty() instead.

  • IsSimple(g)

    ST_IsSimple() andIsSimple() are synonyms. For more information, see the description ofST_IsSimple().

    IsSimple() is deprecated; expect it to be removed in a future MySQL release. UseST_IsSimple() instead.

  • SRID(g)

    ST_SRID() andSRID() are synonyms. For more information, see the description ofST_SRID().

    SRID() is deprecated; expect it to be removed in a future MySQL release. UseST_SRID() instead.

  • ST_Dimension(g)

    Returns the inherent dimension of the geometry valueg, orNULL if the argument isNULL. The dimension can be −1, 0, 1, or 2. The meaning of these values is given inSection 11.4.2.2, “Geometry Class”.

    mysql> SELECT ST_Dimension(ST_GeomFromText('LineString(1 1,2 2)'));+------------------------------------------------------+| ST_Dimension(ST_GeomFromText('LineString(1 1,2 2)')) |+------------------------------------------------------+|                                                    1 |+------------------------------------------------------+

    ST_Dimension() andDimension() are synonyms.

  • ST_Envelope(g)

    Returns the minimum bounding rectangle (MBR) for the geometry valueg, orNULL if the argument isNULL. The result is returned as aPolygon value that is defined by the corner points of the bounding box:

    POLYGON((MINX MINY, MAXX MINY, MAXX MAXY, MINX MAXY, MINX MINY))
    mysql> SELECT ST_AsText(ST_Envelope(ST_GeomFromText('LineString(1 1,2 2)')));+----------------------------------------------------------------+| ST_AsText(ST_Envelope(ST_GeomFromText('LineString(1 1,2 2)'))) |+----------------------------------------------------------------+| POLYGON((1 1,2 1,2 2,1 2,1 1))                                 |+----------------------------------------------------------------+

    If the argument is a point or a vertical or horizontal line segment,ST_Envelope() returns the point or the line segment as its MBR rather than returning an invalid polygon:

    mysql> SELECT ST_AsText(ST_Envelope(ST_GeomFromText('LineString(1 1,1 2)')));+----------------------------------------------------------------+| ST_AsText(ST_Envelope(ST_GeomFromText('LineString(1 1,1 2)'))) |+----------------------------------------------------------------+| LINESTRING(1 1,1 2)                                            |+----------------------------------------------------------------+

    ST_Envelope() andEnvelope() are synonyms.

  • ST_GeometryType(g)

    Returns a binary string indicating the name of the geometry type of which the geometry instanceg is a member, orNULL if the argument isNULL. The name corresponds to one of the instantiableGeometry subclasses.

    mysql> SELECT ST_GeometryType(ST_GeomFromText('POINT(1 1)'));+------------------------------------------------+| ST_GeometryType(ST_GeomFromText('POINT(1 1)')) |+------------------------------------------------+| POINT                                          |+------------------------------------------------+

    ST_GeometryType() andGeometryType() are synonyms.

  • ST_IsEmpty(g)

    This function is a placeholder that returns 0 for any valid geometry value, 1 for any invalid geometry value, orNULL if the argument isNULL.

    MySQL does not support GISEMPTY values such asPOINT EMPTY.

    ST_IsEmpty() andIsEmpty() are synonyms.

  • ST_IsSimple(g)

    Returns 1 if the geometry valueg has no anomalous geometric points, such as self-intersection or self-tangency.ST_IsSimple() returns 0 if the argument is not simple, andNULL if the argument isNULL.

    The descriptions of the instantiable geometric classes given underSection 11.4.2, “The OpenGIS Geometry Model” includes the specific conditions that cause class instances to be classified as not simple.

    ST_IsSimple() andIsSimple() are synonyms.

  • ST_SRID(g)

    Returns an integer indicating the spatial reference system ID associated with the geometry valueg, orNULL if the argument isNULL.

    mysql> SELECT ST_SRID(ST_GeomFromText('LineString(1 1,2 2)',101));+-----------------------------------------------------+| ST_SRID(ST_GeomFromText('LineString(1 1,2 2)',101)) |+-----------------------------------------------------+|                                                 101 |+-----------------------------------------------------+

    ST_SRID() andSRID() are synonyms.