ST_REVERSE()

All functions > GEOSPATIAL > ST_REVERSE()

Returns a geometry with the vertex order of each component reversed.

Signatures

Reverse

Returns: Same sub kind as input, with reversed vertex order

ST_REVERSE(geo: T) → T
sql
ParameterTypeRequiredDescription
geoTYesGeometry value

With:

  • T : Custom types: GEOM_POINT | GEOM_LINESTRING | GEOM_POLYGON | GEOM_MULTIPOINT | GEOM_MULTILINESTRING | GEOM_MULTIPOLYGON | GEOM_MULTIANY

Signature notes:

  • For LineString: reverses the order of vertices (start becomes end)
  • For Polygon: reverses the ring orientation of the outer ring and all inner rings
  • For Multi* and GeometryCollection: reverses each sub-geometry independently
  • For Point: returns the same point (no-op)
  • Not supported on BigQuery
  • GEOMETRY only (no GEOGRAPHY overload)
  • Returns NULL if the input is NULL

Examples

FeatureQL
SELECT
    f1 := ST_ASTEXT(ST_REVERSE(ST_GEOMFROMTEXT('LINESTRING (0 0, 1 1, 2 0)'))) -- Reversed LineString
;
Result
f1 VARCHAR
LINESTRING (2 0, 1 1, 0 0)

Last update at: 2026/05/26 17:22:09