These functions return properties of 这些函数返回GeometryCollection
values.GeometryCollection
值的属性。
Unless otherwise specified, functions in this section handle their geometry arguments as follows:除非另有规定,否则本节中的函数按如下方式处理其几何参数:
If any argument is 如果任何参数为NULL
or any geometry argument is an empty geometry, the return value is NULL
.NULL
或任何几何参数为空几何体,则返回值为NULL
。
If any geometry argument is not a syntactically well-formed geometry, an 如果任一个几何体参数不是语法格式良好的几何体,则会发生ER_GIS_INVALID_DATA
error occurs.ER_GIS_INVALID_DATA
错误。
If any geometry argument is a syntactically well-formed geometry in an undefined spatial reference system (SRS), an 如果任一个几何参数是未定义空间参考系(SRS)中语法结构良好的几何体,则会发生ER_SRS_NOT_FOUND
error occurs.ER_SRS_NOT_FOUND
错误。
Otherwise, the return value is non-否则,返回值为非NULL
.NULL
。
These functions are available for obtaining geometry collection properties:这些函数可用于获取几何图形集合属性:
Returns the 返回N
-th geometry in the GeometryCollection
value gc
. GeometryCollection
值gc
中的第N
个几何体。Geometries are numbered beginning with 1.几何体从1开始编号。
ST_GeometryN()
handles its arguments as described in the introduction to this section.ST_GeometryN()
处理其参数,如本节简介中所述。
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) | +-------------------------------------------------+
Returns the number of geometries in the 返回GeometryCollection
value gc
.GeometryCollection
值gc
中的几何体数。
ST_NumGeometries()
handles its arguments as described in the introduction to this section.ST_NumGeometries()
处理其参数,如本节简介中所述。
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 | +----------------------------------------+