12.16.7.5 GeometryCollection 属性函数

这些函数返回GeometryCollection值的属性。

GeometryN(gc, N)

ST_GeometryN()GeometryN()是同义词。有关更多信息,请参见ST_GeometryN()的描述。

GeometryN()已过时,将在以后的 MySQL 版本中删除。请改用ST_GeometryN()

NumGeometries(gc)

ST_NumGeometries()NumGeometries()是同义词。有关更多信息,请参见ST_NumGeometries()的描述。

NumGeometries()已过时,将在以后的 MySQL 版本中删除。请改用ST_NumGeometries()

ST_GeometryN(gc, N)

返回GeometryCollection值* gc 中第 N *个几何。几何从 1 开始编号。如果任何参数为NULL或几何参数为空几何,则返回值为NULL

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()GeometryN()是同义词。

ST_NumGeometries(gc)

返回GeometryCollection值* gc *中的几何数。如果参数为NULL或空的几何图形,则返回值为NULL

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()NumGeometries()是同义词。