Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to: Databricks Runtime 17.1 and above
Important
This feature is in Public Preview.
Parses the WKB description of a geometry and returns the corresponding GEOMETRY
value.
The SRID value of the returned GEOMETRY
value is the value of the sridExpr
if specified, or 0 otherwise.
Syntax
st_geomfromwkb ( wkbExpr[, sridExpr] )
Arguments
wkbExpr
: ABINARY
value, representing a geometry in WKB format.sridExpr
: An optionalINTEGER
value that is set to be the SRID of the returnedGEOMETRY
value.
Returns
A value of type GEOMETRY(srid)
where srid
is the value of sridExpr
if sridExpr
is a constant (foldable) expression, or GEOMETRY(ANY)
otherwise.
If sridExpr
is omitted the type of the returned value is GEOMETRY(0)
. The returned value is the geometry corresponding to the input WKB description.
The function returns NULL
if any of the inputs is NULL
.
Error conditions
- If the value of
wkbExpr
is an invalid WKB description, the function returns WKB_PARSE_ERROR. - If the value of
sridExpr
is unsupported, the function returnsST_INVALID_SRID_VALUE
.
Examples
-- Simple example where we do not specify the output SRID. It defaults to 0. Input is in little-endian format.
> SELECT st_asewkt(st_geomfromwkb(X'01D1070000000000000000244000000000000041400000000000003740'))
POINT M (10 34 23)
-- Simple example where we do not specify the output SRID. It defaults to 0. Input is in big-endian format.
> SELECT st_asewkt(st_geomfromwkb(X'00000007D1402400000000000040410000000000004037000000000000'))
POINT M (10 34 23)
-- Simple example where we specify the SRID value for the output.
> SELECT st_asewkt(st_geomfromwkb(X'01D1070000000000000000244000000000000041400000000000003740', 3857))
SRID-3857;POINT M (10 34 23)
Related functions
st_asbinary
functionst_asewkb
functionst_asewkt
functionst_asgeojson
functionst_astext
functionst_geogfromgeojson
functionst_geogfromtext
functionst_geogfromwkb
functionst_geomfromewkb
functionst_geomfromgeojson
functionst_geomfromtext
functionto_geography
functionto_geometry
functiontry_to_geography
functiontry_to_geometry
function