Documentation Home
MySQL 8.0 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 33.3Mb
PDF (A4) - 33.3Mb
PDF (RPM) - 31.3Mb
HTML Download (TGZ) - 7.9Mb
HTML Download (Zip) - 8.0Mb
HTML Download (RPM) - 6.8Mb
Man Pages (TGZ) - 144.9Kb
Man Pages (Zip) - 205.9Kb
Info (Gzip) - 3.0Mb
Info (Zip) - 3.0Mb


MySQL 8.0 Reference Manual  /  ...  /  Functions That Create Geometry Values from WKB Values

Pre-General Availability Draft: 2017-09-19

12.15.4 Functions That Create Geometry Values from WKB Values

These functions take as arguments a BLOB containing a Well-Known Binary (WKB) representation and, optionally, a spatial reference system identifier (SRID). They return the corresponding geometry.

The functions interpret geographic coordinates (latitude, longitude) as in the order specified by the spatial reference system. An optional options argument may be given to override the default axis order.

ST_GeomFromWKB() accepts a WKB value of any geometry type as its first argument. 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.15.5, “MySQL-Specific Functions That Create Geometry Values”. Geometry arguments are no longer permitted and produce an error. To migrate calls from using geometry arguments to using WKB arguments, follow these guidelines:

  • Rewrite constructs such as ST_GeomFromWKB(Point(0, 0)) as 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).

For a description of WKB format, see Well-Known Binary (WKB) Format.

  • ST_GeomCollFromWKB(wkb[, srid [, options]]), ST_GeometryCollectionFromWKB(wkb[, srid [, options]])

    Constructs a GeometryCollection value using its WKB representation and SRID.

    The result is NULL if the WKB or SRID argument is NULL.

    The functions interpret geographic coordinates (latitude, longitude) as in the order specified by the spatial reference system. An optional options argument may be given to override the default axis order.

    The result is NULL if the options argument is NULL. If the options argument is invalid, an error occurs to indicate why.

  • ST_GeomFromWKB(wkb[, srid [, options]]), ST_GeometryFromWKB(wkb[, srid [, options]])

    Constructs a geometry value of any type using its WKB representation and SRID.

    The result is NULL if the WKB or SRID argument is NULL.

    The functions interpret geographic coordinates (latitude, longitude) as in the order specified by the spatial reference system. An optional options argument may be given to override the default axis order.

    The result is NULL if the options argument is NULL. If the options argument is invalid, an error occurs to indicate why.

  • ST_LineFromWKB(wkb[, srid [, options]]), ST_LineStringFromWKB(wkb[, srid [, options]])

    Constructs a LineString value using its WKB representation and SRID.

    The result is NULL if the WKB or SRID argument is NULL.

    The functions interpret geographic coordinates (latitude, longitude) as in the order specified by the spatial reference system. An optional options argument may be given to override the default axis order.

    The result is NULL if the options argument is NULL. If the options argument is invalid, an error occurs to indicate why.

  • ST_MLineFromWKB(wkb[, srid [, options]]), ST_MultiLineStringFromWKB(wkb[, srid [, options]])

    Constructs a MultiLineString value using its WKB representation and SRID.

    The result is NULL if the WKB or SRID argument is NULL.

    The functions interpret geographic coordinates (latitude, longitude) as in the order specified by the spatial reference system. An optional options argument may be given to override the default axis order.

    The result is NULL if the options argument is NULL. If the options argument is invalid, an error occurs to indicate why.

  • ST_MPointFromWKB(wkb[, srid [, options]]), ST_MultiPointFromWKB(wkb[, srid [, options]])

    Constructs a MultiPoint value using its WKB representation and SRID.

    The result is NULL if the WKB or SRID argument is NULL.

    The functions interpret geographic coordinates (latitude, longitude) as in the order specified by the spatial reference system. An optional options argument may be given to override the default axis order.

    The result is NULL if the options argument is NULL. If the options argument is invalid, an error occurs to indicate why.

  • ST_MPolyFromWKB(wkb[, srid [, options]]), ST_MultiPolygonFromWKB(wkb[, srid [, options]])

    Constructs a MultiPolygon value using its WKB representation and SRID.

    The result is NULL if the WKB or SRID argument is NULL.

    The functions interpret geographic coordinates (latitude, longitude) as in the order specified by the spatial reference system. An optional options argument may be given to override the default axis order.

    The result is NULL if the options argument is NULL. If the options argument is invalid, an error occurs to indicate why.

  • ST_PointFromWKB(wkb[, srid [, options]])

    Constructs a Point value using its WKB representation and SRID.

    The result is NULL if the WKB or SRID argument is NULL.

    The functions interpret geographic coordinates (latitude, longitude) as in the order specified by the spatial reference system. An optional options argument may be given to override the default axis order.

    The result is NULL if the options argument is NULL. If the options argument is invalid, an error occurs to indicate why.

  • ST_PolyFromWKB(wkb[, srid [, options]]), ST_PolygonFromWKB(wkb[, srid [, options]])

    Constructs a Polygon value using its WKB representation and SRID.

    The result is NULL if the WKB or SRID argument is NULL.

    The functions interpret geographic coordinates (latitude, longitude) as in the order specified by the spatial reference system. An optional options argument may be given to override the default axis order.

    The result is NULL if the options argument is NULL. If the options argument is invalid, an error occurs to indicate why.


User Comments
Sign Up Login You must be logged in to post a comment.