St Functions¶
This page lists all st functions available in Spark SQL.
st_asbinary¶
st_asbinary(geo) - Returns the geospatial value (value of type GEOGRAPHY or GEOMETRY) in WKB format.
Arguments:
- geo - A geospatial value, either a GEOGRAPHY or a GEOMETRY.
Examples:
> SELECT hex(st_asbinary(st_geogfromwkb(X'0101000000000000000000F03F0000000000000040')));
0101000000000000000000F03F0000000000000040
> SELECT hex(st_asbinary(st_geomfromwkb(X'0101000000000000000000F03F0000000000000040')));
0101000000000000000000F03F0000000000000040
Since: 4.1.0
st_geogfromwkb¶
st_geogfromwkb(wkb) - Parses the WKB description of a geography and returns the corresponding GEOGRAPHY value.
Arguments:
- wkb - A BINARY value in WKB format, representing a GEOGRAPHY value.
Examples:
> SELECT hex(st_asbinary(st_geogfromwkb(X'0101000000000000000000F03F0000000000000040')));
0101000000000000000000F03F0000000000000040
Since: 4.1.0
st_geomfromwkb¶
st_geomfromwkb(wkb) - Parses the WKB description of a geometry and returns the corresponding GEOMETRY value.
Arguments:
- wkb - A BINARY value in WKB format, representing a GEOMETRY value.
Examples:
> SELECT hex(st_asbinary(st_geomfromwkb(X'0101000000000000000000F03F0000000000000040')));
0101000000000000000000F03F0000000000000040
Since: 4.1.0
st_setsrid¶
st_setsrid(geo, srid) - Returns a new GEOGRAPHY or GEOMETRY value whose SRID is the specified SRID value.
Arguments:
- geo - A GEOGRAPHY or GEOMETRY value.
- srid - The new SRID value of the geography or geometry.
Examples:
> SELECT st_srid(st_setsrid(ST_GeogFromWKB(X'0101000000000000000000F03F0000000000000040'), 4326));
4326
> SELECT st_srid(st_setsrid(ST_GeomFromWKB(X'0101000000000000000000F03F0000000000000040'), 3857));
3857
Since: 4.1.0
st_srid¶
st_srid(geo) - Returns the SRID of the input GEOGRAPHY or GEOMETRY value.
Arguments:
- geo - A GEOGRAPHY or GEOMETRY value.
Examples:
> SELECT st_srid(st_geogfromwkb(X'0101000000000000000000F03F0000000000000040'));
4326
> SELECT st_srid(st_geomfromwkb(X'0101000000000000000000F03F0000000000000040'));
0
> SELECT st_srid(NULL);
NULL
Since: 4.1.0