st_reverse
function
Applies to: Databricks Runtime 17.1 and above
Preview
This feature is in Public Preview.
Reverses the input GEOGRAPHY
or GEOMETRY
value.
Syntax
st_reverse ( geoExpr )
Arguments
geoExpr
: AGEOGRAPHY
orGEOMETRY
value.
Returns
A value of type GEOGRAPHY
or GEOMETRY
, representing the reversed geospatial value.
The SRID value of the output GEOGRAPHY
or GEOMETRY
value is equal to that of the input value.
The dimension of the output GEOGRAPHY
or GEOMETRY
value is the same as that of the input value.
The function returns NULL
if any of the inputs is NULL
.
Examples
SQL
-- Reverse a linestring geometry.
> SELECT st_astext(st_reverse(st_geomfromtext('LINESTRING(1 2,3 4,5 6)')));
LINESTRING(5 6,3 4,1 2)
-- Reverse a multipoint geography.
> SELECT st_asewkt(st_reverse(st_geogfromtext('MULTIPOINT((1 2),EMPTY,(3 4),(5 6),EMPTY)')));
SRID=4326;MULTIPOINT((1 2),EMPTY,(3 4),(5 6),EMPTY)