12.16.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.
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.
These functions also accept geometry objects as returned by the functions in Section 12.16.5, “MySQL-Specific Functions That Create Geometry Values”. Thus, those functions may be used to provide the first argument to the functions in this section. However, as of MySQL 5.7.19, use of geometry arguments is deprecated and generates a warning. Geometry arguments are not accepted in MySQL 8.0. To migrate calls from using geometry arguments to using WKB arguments, follow these guidelines:
For a description of WKB format, see Well-Known Binary (WKB) Format.
Rewrite constructs such as
ST_GeomFromWKB(Point(0, 0))
asPoint(0, 0)
.Rewrite constructs such as
ST_GeomFromWKB(Point(0, 0), 4326)
asST_GeomFromWKB(ST_AsWKB(Point(0, 0)), 4326)
. (Alternatively, in MySQL 8.0, you can useST_SRID(Point(0, 0), 4326)
.)
GeomCollFromWKB(
,wkb
[,srid
])GeometryCollectionFromWKB(
wkb
[,srid
])ST_GeomCollFromWKB()
,ST_GeometryCollectionFromWKB()
,GeomCollFromWKB()
, andGeometryCollectionFromWKB()
are synonyms. For more information, see the description ofST_GeomCollFromWKB()
.GeomCollFromWKB()
andGeometryCollectionFromWKB()
are deprecated and will be removed in a future MySQL release. UseST_GeomCollFromWKB()
andST_GeometryCollectionFromWKB()
instead.GeomFromWKB(
,wkb
[,srid
])GeometryFromWKB(
wkb
[,srid
])ST_GeomFromWKB()
,ST_GeometryFromWKB()
,GeomFromWKB()
, andGeometryFromWKB()
are synonyms. For more information, see the description ofST_GeomFromWKB()
.GeomFromWKB()
andGeometryFromWKB()
are deprecated and will be removed in a future MySQL release. UseST_GeomFromWKB()
andST_GeometryFromWKB()
instead.LineFromWKB(
,wkb
[,srid
])LineStringFromWKB(
wkb
[,srid
])ST_LineFromWKB()
,ST_LineStringFromWKB()
,LineFromWKB()
, andLineStringFromWKB()
are synonyms. For more information, see the description ofST_LineFromWKB()
.LineFromWKB()
andLineStringFromWKB()
are deprecated and will be removed in a future MySQL release. UseST_LineFromWKB()
andST_LineStringFromWKB()
instead.MLineFromWKB(
,wkb
[,srid
])MultiLineStringFromWKB(
wkb
[,srid
])ST_MLineFromWKB()
,ST_MultiLineStringFromWKB()
,MLineFromWKB()
, andMultiLineStringFromWKB()
are synonyms. For more information, see the description ofST_MLineFromWKB()
.MLineFromWKB()
andMultiLineStringFromWKB()
are deprecated and will be removed in a future MySQL release. UseST_MLineFromWKB()
andST_MultiLineStringFromWKB()
instead.MPointFromWKB(
,wkb
[,srid
])MultiPointFromWKB(
wkb
[,srid
])ST_MPointFromWKB()
,ST_MultiPointFromWKB()
,MPointFromWKB()
, andMultiPointFromWKB()
are synonyms. For more information, see the description ofST_MPointFromWKB()
.MPointFromWKB()
andMultiPointFromWKB()
are deprecated and will be removed in a future MySQL release. UseST_MPointFromWKB()
andST_MultiPointFromWKB()
instead.MPolyFromWKB(
,wkb
[,srid
])MultiPolygonFromWKB(
wkb
[,srid
])ST_MPolyFromWKB()
,ST_MultiPolygonFromWKB()
,MPolyFromWKB()
, andMultiPolygonFromWKB()
are synonyms. For more information, see the description ofST_MPolyFromWKB()
.MPolyFromWKB()
andMultiPolygonFromWKB()
are deprecated and will be removed in a future MySQL release. UseST_MPolyFromWKB()
andST_MultiPolygonFromWKB()
instead.ST_PointFromWKB()
andPointFromWKB()
are synonyms. For more information, see the description ofST_PointFromWKB()
.PointFromWKB()
is deprecated and will be removed in a future MySQL release. UseST_PointFromWKB()
instead.PolyFromWKB(
,wkb
[,srid
])PolygonFromWKB(
wkb
[,srid
])ST_PolyFromWKB()
,ST_PolygonFromWKB()
,PolyFromWKB()
, andPolygonFromWKB()
are synonyms. For more information, see the description ofST_PolyFromWKB()
.PolyFromWKB()
andPolygonFromWKB()
are deprecated and will be removed in a future MySQL release. UseST_PolyFromWKB()
andST_PolygonFromWKB()
instead.ST_GeomCollFromWKB(
,wkb
[,srid
])ST_GeometryCollectionFromWKB(
wkb
[,srid
])Constructs a
GeometryCollection
value using its WKB representation and SRID.The result is
NULL
if the WKB or SRID argument isNULL
.ST_GeomCollFromWKB()
,ST_GeometryCollectionFromWKB()
,GeomCollFromWKB()
, andGeometryCollectionFromWKB()
are synonyms.ST_GeomFromWKB(
,wkb
[,srid
])ST_GeometryFromWKB(
wkb
[,srid
])Constructs a geometry value of any type using its WKB representation and SRID.
The result is
NULL
if the WKB or SRID argument isNULL
.ST_GeomFromWKB()
,ST_GeometryFromWKB()
,GeomFromWKB()
, andGeometryFromWKB()
are synonyms.ST_LineFromWKB(
,wkb
[,srid
])ST_LineStringFromWKB(
wkb
[,srid
])Constructs a
LineString
value using its WKB representation and SRID.The result is
NULL
if the WKB or SRID argument isNULL
.ST_LineFromWKB()
,ST_LineStringFromWKB()
,LineFromWKB()
, andLineStringFromWKB()
are synonyms.ST_MLineFromWKB(
,wkb
[,srid
])ST_MultiLineStringFromWKB(
wkb
[,srid
])Constructs a
MultiLineString
value using its WKB representation and SRID.The result is
NULL
if the WKB or SRID argument isNULL
.ST_MLineFromWKB()
,ST_MultiLineStringFromWKB()
,MLineFromWKB()
, andMultiLineStringFromWKB()
are synonyms.ST_MPointFromWKB(
,wkb
[,srid
])ST_MultiPointFromWKB(
wkb
[,srid
])Constructs a
MultiPoint
value using its WKB representation and SRID.The result is
NULL
if the WKB or SRID argument isNULL
.ST_MPointFromWKB()
,ST_MultiPointFromWKB()
,MPointFromWKB()
, andMultiPointFromWKB()
are synonyms.ST_MPolyFromWKB(
,wkb
[,srid
])ST_MultiPolygonFromWKB(
wkb
[,srid
])Constructs a
MultiPolygon
value using its WKB representation and SRID.The result is
NULL
if the WKB or SRID argument isNULL
.ST_MPolyFromWKB()
,ST_MultiPolygonFromWKB()
,MPolyFromWKB()
, andMultiPolygonFromWKB()
are synonyms.Constructs a
Point
value using its WKB representation and SRID.The result is
NULL
if the WKB or SRID argument isNULL
.ST_PointFromWKB()
andPointFromWKB()
are synonyms.ST_PolyFromWKB(
,wkb
[,srid
])ST_PolygonFromWKB(
wkb
[,srid
])Constructs a
Polygon
value using its WKB representation and SRID.The result is
NULL
if the WKB or SRID argument isNULL
.ST_PolyFromWKB()
,ST_PolygonFromWKB()
,PolyFromWKB()
, andPolygonFromWKB()
are synonyms.