These functions take as arguments a 这些函数将包含已知BLOB
containing a Well-Known Binary (WKB) representation and, optionally, a spatial reference system identifier (SRID). BLOB
(WKB)表示和空间参考系统标识符(SRID)的BLOB作为参数。They return the corresponding geometry. 它们返回相应的几何图形。For a description of WKB format, see Well-Known Binary (WKB) Format.有关WKB格式的说明,请参阅众所周知的二进制(WKB)格式。
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_GeomFromWKB()
accepts a WKB value of any geometry type as its first argument. ST_GeomFromWKB()
接受任何几何体类型的WKB值作为其第一个参数。Other functions provide type-specific construction functions for construction of geometry values of each geometry type.其他函数提供特定于类型的构造函数,用于构造每个几何图形类型的几何图形值。
Prior to MySQL 8.0, these functions also accepted geometry objects as returned by the functions in Section 12.17.5, “MySQL-Specific Functions That Create Geometry Values”. 在MySQL 8.0之前,这些函数还接受第12.17.5节,“创建几何值的MySQL特定函数”中函数返回的几何对象。Geometry arguments are no longer permitted and produce an error. 几何参数不再被允许并产生错误。To migrate calls from using geometry arguments to using WKB arguments, follow these guidelines:要将调用从使用geometry
参数迁移到使用WKB参数,请遵循以下准则:
Rewrite constructs such as 将诸如ST_GeomFromWKB(Point(0, 0))
as Point(0, 0)
.ST_GeomFromWKB(Point(0, 0))
之类的构造重写为Point(0, 0)
。
Rewrite constructs such as 将结构(如ST_GeomFromWKB(Point(0, 0), 4326)
as ST_SRID(Point(0, 0), 4326)
or ST_GeomFromWKB(ST_AsWKB(Point(0, 0)), 4326)
.ST_GeomFromWKB(Point(0, 0), 4326)
)重写为ST_SRID(Point(0, 0), 4326)
或ST_GeomFromWKB(ST_AsWKB(Point(0, 0)), 4326)
。
Unless otherwise specified, functions in this section handle their geometry arguments as follows:除非另有规定,否则本节中的函数按如下方式处理其几何参数:
If the WKB or SRID argument is 如果WKB或SRID参数为NULL
, the return value is NULL
.NULL
,则返回值为NULL
。
By default, geographic coordinates (latitude, longitude) are interpreted as in the order specified by the spatial reference system of geometry arguments. 默认情况下,地理坐标(纬度、经度)按几何参数的空间参照系指定的顺序进行解释。An optional 可以提供一个可选的options
argument may be given to override the default axis order. options
参数来覆盖默认的轴顺序。选项由逗号分隔的options
consists of a list of comma-separated
. key
=value
列表组成。key
=value
The only permitted 唯一允许的key
value is axis-order
, with permitted values of lat-long
, long-lat
and srid-defined
(the default).key
值是axis-order
,允许值为lat-long
、long-lat
和srid-defined
(默认值)。
If the 如果options
argument is NULL
, the return value is NULL
. options
参数为NULL
,则返回值为NULL
。If the 如果options
argument is invalid, an error occurs to indicate why.options
参数无效,则会出现一个错误来说明原因。
If an SRID argument refers to an undefined spatial reference system (SRS), an 如果SRID参数引用未定义的空间参考系(SRS),则会发生ER_SRS_NOT_FOUND
error occurs.ER_SRS_NOT_FOUND
错误。
For geographic SRS geometry arguments, if any argument has a longitude or latitude that is out of range, an error occurs:对于地理SRS几何参数,如果任何参数的经度或纬度超出范围,则会发生错误:
If a longitude value is not in the range (−180, 180], an 如果经度值不在范围(180,180]内,则会发生ER_LONGITUDE_OUT_OF_RANGE
error occurs.ER_LONGITUDE_OUT_OF_RANGE
错误。
If a latitude value is not in the range [−90, 90], an 如果纬度值不在[90,90]范围内,则会发生ER_LATITUDE_OUT_OF_RANGE
error occurs.ER_LATITUDE_OUT_OF_RANGE
错误。
Ranges shown are in degrees. 显示的范围以度为单位。If an SRS uses another unit, the range uses the corresponding values in its unit. 如果SRS使用另一个单位,则范围使用其单位中的相应值。The exact range limits deviate slightly due to floating-point arithmetic.由于采用浮点运算,精确的范围限制略有偏差。
These functions are available for creating geometries from WKB values:这些函数可用于从WKB值创建几何图形:
ST_GeomCollFromWKB(
, wkb
[, srid
[, options
]])ST_GeometryCollectionFromWKB(
wkb
[, srid
[, options
]])
Constructs a 使用其WKB表示形式和SRID构造GeometryCollection
value using its WKB representation and SRID.GeometryCollection
值。
These functions handle their arguments as described in the introduction to this section.这些函数处理它们的参数,如本节简介中所述。
ST_GeomFromWKB(
, wkb
[, srid
[, options
]])ST_GeometryFromWKB(
wkb
[, srid
[, options
]])
Constructs a geometry value of any type using its WKB representation and SRID.使用WKB表示和SRID构造任何类型的几何体值。
These functions handle their arguments as described in the introduction to this section.这些函数处理它们的参数,如本节简介中所述。
ST_LineFromWKB(
, wkb
[, srid
[, options
]])ST_LineStringFromWKB(
wkb
[, srid
[, options
]])
Constructs a 使用其WKB表示形式和SRID构造一个LineString
value using its WKB representation and SRID.LineString
值。
These functions handle their arguments as described in the introduction to this section.这些函数处理它们的参数,如本节简介中所述。
ST_MLineFromWKB(
, wkb
[, srid
[, options
]])ST_MultiLineStringFromWKB(
wkb
[, srid
[, options
]])
Constructs a 使用WKB表示和SRID构造MultiLineString
value using its WKB representation and SRID.MultiLineString
。
These functions handle their arguments as described in the introduction to this section.这些函数处理它们的参数,如本节简介中所述。
ST_MPointFromWKB(
, wkb
[, srid
[, options
]])ST_MultiPointFromWKB(
wkb
[, srid
[, options
]])
Constructs a 使用WKB表示和SRID构造MultiPoint
value using its WKB representation and SRID.MultiPoint
值。
These functions handle their arguments as described in the introduction to this section.这些函数处理它们的参数,如本节简介中所述。
ST_MPolyFromWKB(
, wkb
[, srid
[, options
]])ST_MultiPolygonFromWKB(
wkb
[, srid
[, options
]])
Constructs a 使用WKB表示和SRID构造MultiPolygon
value using its WKB representation and SRID.MultiPolygon
。
These functions handle their arguments as described in the introduction to this section.这些函数处理它们的参数,如本节简介中所述。
ST_PointFromWKB(
wkb
[, srid
[, options
]])
Constructs a 使用其WKB表示和SRID构造一个Point
value using its WKB representation and SRID.Point
值。
ST_PointFromWKB()
handles its arguments as described in the introduction to this section.ST_PointFromWKB()
处理其参数,如本节简介中所述。
ST_PolyFromWKB(
, wkb
[, srid
[, options
]])ST_PolygonFromWKB(
wkb
[, srid
[, options
]])
Constructs a 使用其WKB表示和SRID构造Polygon
value using its WKB representation and SRID.Polygon
值。
These functions handle their arguments as described in the introduction to this section.这些函数处理它们的参数,如本节简介中所述。