These functions return properties of
GeometryCollection values.
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.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.Returns the
N-th geometry in theGeometryCollectionvaluegc. Geometries are numbered beginning with 1. If any argument isNULLor 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.Returns the number of geometries in the
GeometryCollectionvaluegc. If the argument isNULLor 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.