文档首页
MySQL 8.4 参考手册
8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

正文为中文,英文原文默认隐藏。点击任意中文段落即可展开 / 收起对应英文原文。

打开官方英文原文 ↗

译文由机器翻译生成,仅供理解参考;有疑问请以官方英文原文为准。

MySQL 8.4 参考手册 / 14 函数和运算符 / 14.16 空间分析函数 / 14.16.5 创建几何值的 MySQL 特定函数
中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 69%

14.16.5 创建几何值的 MySQL 特有函数14.16.5 MySQL-Specific Functions That Create Geometry Values

MySQL 提供了一组用于创建几何值的有用非标准函数。本节中描述的函数是 MySQL 对 OpenGIS 规范的扩展。MySQL provides a set of useful nonstandard functions for creating geometry values. The functions described in this section are MySQL extensions to the OpenGIS specification.

这些函数根据 WKB 值或几何对象作为参数生成几何对象。如果任何参数不是正确的 WKB 或适当类型的几何表示,则返回值为 NULL。These functions produce geometry objects from either WKB values or geometry objects as arguments. If any argument is not a proper WKB or geometry representation of the proper object type, the return value is NULL.

例如,你可以将 Point() 的几何返回值直接插入到 POINT 列中:For example, you can insert the geometry return value from Point() directly into a POINT column:

INSERT INTO t1 (pt_col) VALUES(Point(1,2));
  • GeomCollection(g [, g] ...)

    根据几何参数构造一个 GeomCollection 值。Constructs a GeomCollection value from the geometry arguments.

    GeomCollection() 返回参数中包含的所有有效几何,即使存在不支持的几何也会返回有效几何。GeomCollection() returns all the proper geometries contained in the arguments even if a nonsupported geometry is present.

    GeomCollection() 不带参数也是允许的,可用于创建一个空几何。此外,像 ST_GeomFromText() 这样的函数接受 WKT 几何集合参数,可以理解 OpenGIS 'GEOMETRYCOLLECTION EMPTY' 标准语法和 MySQL 'GEOMETRYCOLLECTION()' 非标准语法。GeomCollection() with no arguments is permitted as a way to create an empty geometry. Also, functions such as ST_GeomFromText() that accept WKT geometry collection arguments understand both OpenGIS 'GEOMETRYCOLLECTION EMPTY' standard syntax and MySQL 'GEOMETRYCOLLECTION()' nonstandard syntax.

    GeomCollection() 和 GeometryCollection() 是同义词,其中 GeomCollection() 是首选函数。GeomCollection() and GeometryCollection() are synonymous, with GeomCollection() the preferred function.

  • GeometryCollection(g [, g] ...)

    根据几何参数构造一个 GeomCollection 值。Constructs a GeomCollection value from the geometry arguments.

    GeometryCollection() 返回参数中包含的所有有效几何,即使存在不支持的几何。GeometryCollection() returns all the proper geometries contained in the arguments even if a nonsupported geometry is present.

    GeometryCollection() 不带参数是允许的,这是一种创建空几何图形的方法。此外,像 ST_GeomFromText() 这样的函数接受 WKT 几何集合参数,它们既能理解 OpenGIS 'GEOMETRYCOLLECTION EMPTY' 标准语法,也能理解 MySQL 'GEOMETRYCOLLECTION()' 非标准语法。GeometryCollection() with no arguments is permitted as a way to create an empty geometry. Also, functions such as ST_GeomFromText() that accept WKT geometry collection arguments understand both OpenGIS 'GEOMETRYCOLLECTION EMPTY' standard syntax and MySQL 'GEOMETRYCOLLECTION()' nonstandard syntax.

    GeomCollection() 和 GeometryCollection() 是同义词,其中 GeomCollection() 是首选函数。GeomCollection() and GeometryCollection() are synonymous, with GeomCollection() the preferred function.

  • LineString(pt [, pt] ...)

    从若干个 Point 或 WKB Point 参数构造一个 LineString 值。如果参数数量少于两个,返回值为 NULL。Constructs a LineString value from a number of Point or WKB Point arguments. If the number of arguments is less than two, the return value is NULL.

  • MultiLineString(ls [, ls] ...)

    使用 LineString 或 WKB LineString 参数构造一个 MultiLineString 值。Constructs a MultiLineString value using LineString or WKB LineString arguments.

  • MultiPoint(pt [, pt2] ...)

    使用 Point 或 WKB Point 参数构建 MultiPoint 值。Constructs a MultiPoint value using Point or WKB Point arguments.

  • MultiPolygon(poly [, poly] ...)

    从一组 Polygon 或 WKB Polygon 参数构建 MultiPolygon 值。Constructs a MultiPolygon value from a set of Polygon or WKB Polygon arguments.

  • Point(x, y)

    使用坐标构建 Point。Constructs a Point using its coordinates.

  • Polygon(ls [, ls] ...)

    从多个 LineString 或 WKB LineString 参数构造一个 Polygon 值。如果任何参数不表示 LinearRing(即非闭合且简单的 LineString),则返回值为 NULL。Constructs a Polygon value from a number of LineString or WKB LineString arguments. If any argument does not represent a LinearRing (that is, not a closed and simple LineString), the return value is NULL.