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.5 GeometryCollection Property Functions

These functions return properties ofGeometryCollection values.

  • GeometryN(gc,N)

    ST_GeometryN() andGeometryN() are synonyms. For more information, see the description ofST_GeometryN().

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

  • NumGeometries(gc)

    ST_NumGeometries() andNumGeometries() are synonyms. For more information, see the description ofST_NumGeometries().

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

  • ST_GeometryN(gc,N)

    Returns theN-th geometry in theGeometryCollection valuegc. Geometries are numbered beginning with 1. If any argument isNULL or the geometry argument is an empty geometry, the return value isNULL.

    mysql> SET @gc = 'GeometryCollection(Point(1 1),LineString(2 2, 3 3))';mysql> SELECT ST_AsText(ST_GeometryN(ST_GeomFromText(@gc),1));+-------------------------------------------------+| ST_AsText(ST_GeometryN(ST_GeomFromText(@gc),1)) |+-------------------------------------------------+| POINT(1 1)                                      |+-------------------------------------------------+

    ST_GeometryN() andGeometryN() are synonyms.

  • ST_NumGeometries(gc)

    Returns the number of geometries in theGeometryCollection valuegc. If the argument isNULL or an empty geometry, the return value isNULL.

    mysql> SET @gc = 'GeometryCollection(Point(1 1),LineString(2 2, 3 3))';mysql> SELECT ST_NumGeometries(ST_GeomFromText(@gc));+----------------------------------------+| ST_NumGeometries(ST_GeomFromText(@gc)) |+----------------------------------------+|                                      2 |+----------------------------------------+

    ST_NumGeometries() andNumGeometries() are synonyms.