12.17.3 Functions That Create Geometry Values from WKT Values从WKT值创建几何图形值的函数

These functions take as arguments a Well-Known Text (WKT) representation and, optionally, a spatial reference system identifier (SRID). 这些函数将众所周知的文本(WKT)表示和空间参考系统标识符(SRID)作为参数。They return the corresponding geometry. 它们返回相应的几何图形。For a description of WKT format, see Well-Known Text (WKT) Format.有关WKT格式的说明,请参阅众所周知的文本(WKT)格式。

Functions in this section detect arguments in either Cartesian or geographic spatial reference systems (SRSs), and return results appropriate to the SRS.本节中的函数检测笛卡尔坐标系或地理空间参考系(SRS)中的参数,并返回适合SRS的结果。

ST_GeomFromText() accepts a WKT value of any geometry type as its first argument. ST_GeomFromText()接受任何几何体类型的WKT值作为其第一个参数。Other functions provide type-specific construction functions for construction of geometry values of each geometry type.其他函数提供特定于类型的构造函数,用于构造每个几何图形类型的几何图形值。

Functions such as ST_MPointFromText() and ST_GeomFromText() that accept WKT-format representations of MultiPoint values permit individual points within values to be surrounded by parentheses. 接受多点值的WKT格式表示形式的函数,如ST_MPointFromText()ST_GeomFromText(),允许值中的各个点用括号括起来。For example, both of the following function calls are valid:例如,以下两个函数调用都是有效的:

ST_MPointFromText('MULTIPOINT (1 1, 2 2, 3 3)')
ST_MPointFromText('MULTIPOINT ((1 1), (2 2), (3 3))')

Functions such as ST_GeomFromText() that accept WKT geometry collection arguments understand both OpenGIS 'GEOMETRYCOLLECTION EMPTY' standard syntax and MySQL 'GEOMETRYCOLLECTION()' nonstandard syntax. 接受WKT geometry集合参数的函数,如ST_geometryfromtext(),既理解OpenGIS的'GEOMETRYCOLLECTION EMPTY'标准语法,也理解MySQL的“GEOMETRYCOLLECTION()”非标准语法。Functions such as ST_AsWKT() that produce WKT values produce 'GEOMETRYCOLLECTION EMPTY' standard syntax:生成WKT值的函数(如ST_AsWKT())将生成'GEOMETRYCOLLECTION EMPTY'标准语法:

mysql> SET @s1 = ST_GeomFromText('GEOMETRYCOLLECTION()');
mysql> SET @s2 = ST_GeomFromText('GEOMETRYCOLLECTION EMPTY');
mysql> SELECT ST_AsWKT(@s1), ST_AsWKT(@s2);
+--------------------------+--------------------------+
| ST_AsWKT(@s1)            | ST_AsWKT(@s2)            |
+--------------------------+--------------------------+
| GEOMETRYCOLLECTION EMPTY | GEOMETRYCOLLECTION EMPTY |
+--------------------------+--------------------------+

Unless otherwise specified, functions in this section handle their geometry arguments as follows:除非另有规定,否则本节中的函数按如下方式处理其几何参数:

These functions are available for creating geometries from WKT values:这些函数可用于从WKT值创建几何图形: