- Categories:
ST_ GEOMETRYFROMWKB¶
Parses a WKB (well-known binary) or EWKB (extended well-known binary) input and returns a value of type GEOMETRY.
- Aliases:
ST_GEOMFROMWKB , ST_GEOMETRYFROMEWKB , ST_GEOMFROMEWKB
- See also:
Syntax¶
Arguments¶
Required:
varchar_or_binary_expressionThe argument must be a string or binary expression in WKB or EWKB that represents a valid geospatial object.
A string expression must be in hexadecimal format (without a leading
0x).
Optional:
sridThe integer value of the SRID to use.
allow_invalidIf TRUE, specifies that the function returns a GEOGRAPHY or GEOMETRY object, even when the input shape isn’t valid and can’t be repaired. For more information, see Specifying how invalid geospatial shapes are handled.
Returns¶
The function returns a value of type GEOMETRY.
Usage notes¶
- Issues an error if the input cannot be parsed as WKB or EWKB.
- For WKB input, if the
sridargument is not specified, the resulting GEOMETRY object has the SRID set to 0.
Examples¶
The following example returns the GEOMETRY object for a geospatial object described in EWKB format:
In the next example, the input is in WKB format, which does not specify the SRID: