空间值或几何体具有在 第 13.4.2.2 节,“几何类” 中描述的属性。下文列出了空间函数一般的参数处理特性。特定函数或函数组可能具有附加的或不同的参数处理特性,这将在这些函数描述所在的章节中讨论。如果存在这种情况,这些描述将优先于此处的一般讨论。Spatial values, or geometries, have the properties described in Section 13.4.2.2, “Geometry Class”. The following discussion lists general spatial function argument-handling characteristics. Specific functions or groups of functions may have additional or different argument-handling characteristics, as discussed in the sections where those function descriptions occur. Where that is true, those descriptions take precedence over the general discussion here.
空间函数仅适用于有效的几何值。参见 第 13.4.4 节,“几何的良构性和有效性”。Spatial functions are defined only for valid geometry values. See Section 13.4.4, “Geometry Well-Formedness and Validity”.
每个几何值都与一个空间参考系统(SRS)相关联,SRS 是一个基于坐标的地理位置系统。请参见 第 13.4.5 节,“空间参考系统支持”。Each geometry value is associated with a spatial reference system (SRS), which is a coordinate-based system for geographic locations. See Section 13.4.5, “Spatial Reference System Support”.
几何的空间参考标识符(SRID)用于标识该几何所定义的 SRS。在 MySQL 中,SRID 值是与几何值相关联的整数。可用的最大 SRID 值是 232−1。如果给定的值更大,则仅使用低 32 位。The spatial reference identifier (SRID) of a geometry identifies the SRS in which the geometry is defined. In MySQL, the SRID value is an integer associated with the geometry value. The maximum usable SRID value is 232−1. If a larger value is given, only the lower 32 bits are used.
SRID 0 表示一个无限平坦的笛卡尔平面,其坐标轴没有分配单位。要确保 SRID 0 的行为,请使用 SRID 0 创建几何值。如果未指定 SRID,SRID 0 是新几何值的默认值。SRID 0 represents an infinite flat Cartesian plane with no units assigned to its axes. To ensure SRID 0 behavior, create geometry values using SRID 0. SRID 0 is the default for new geometry values if no SRID is specified.
对于多个几何值的计算,所有值必须处于相同的空间参考系统(SRS),否则会发生错误。因此,接受多个几何参数的空间函数要求这些参数必须在相同的 SRS 中。如果空间函数返回 ER_GIS_DIFFERENT_SRIDS,这意味着几何参数并不全部处于相同的 SRS 中。您必须修改它们以拥有相同的 SRS。For computations on multiple geometry values, all values must be
in the same SRS or an error occurs. Thus, spatial functions that
take multiple geometry arguments require those arguments to be in
the same SRS. If a spatial function returns
ER_GIS_DIFFERENT_SRIDS, it means
that the geometry arguments were not all in the same SRS. You must
modify them to have the same SRS.
由空间函数返回的几何体采用几何体参数的空间参考系统,因为任何空间函数产生的几何体值都会继承几何体参数的 SRID。A geometry returned by a spatial function is in the SRS of the geometry arguments because geometry values produced by any spatial function inherit the SRID of the geometry arguments.
开放地理空间联盟指南要求输入的多边形必须已经封闭,因此未封闭的多边形将被视为无效而被拒绝,而不会自动封闭。The Open Geospatial Consortium guidelines require that input polygons already be closed, so unclosed polygons are rejected as invalid rather than being closed.
在 MySQL 中,唯一有效的空几何体以空几何集合的形式表示。空几何集合的处理如下:空 WKT 输入几何集合可以指定为 'GEOMETRYCOLLECTION()'。这也是产生空几何集合的空间操作的输出 WKT 形式。In MySQL, the only valid empty geometry is represented in the form
of an empty geometry collection. Empty geometry collection
handling is as follows: An empty WKT input geometry collection may
be specified as 'GEOMETRYCOLLECTION()'. This is
also the output WKT resulting from a spatial operation that
produces an empty geometry collection.
在解析嵌套几何集合时,该集合会被展平,其基本组件会在各种 GIS 操作中被使用以计算结果。这为用户提供了额外的灵活性,因为无需关注几何数据的唯一性。嵌套几何集合可以通过嵌套的 GIS 函数调用生成,而不必首先显式地进行展平。During parsing of a nested geometry collection, the collection is flattened and its basic components are used in various GIS operations to compute results. This provides additional flexibility to users because it is unnecessary to be concerned about the uniqueness of geometry data. Nested geometry collections may be produced from nested GIS function calls without having to be explicitly flattened first.