This topic describes the ST_Reverse function. This function returns a geometry object of the reversed order of the vertices of the input geometry object.

Syntax

geometry  ST_Reverse(geometry  g1);

Parameters

Parameter Description
g1 The geometry object that you want to specify.

Description

  • The ST_Reverse function can reverse the order of the vertices of all geometry objects.
  • This function supports polyhedral surfaces.
  • This function supports 3D objects and does not delete z coordinates.

Examples

SELECT ST_AsText(ST_Reverse(ST_GeomFromText('LINESTRING(2 1,1 1)')));
      st_astext
---------------------
 LINESTRING(1 1,2 1)
(1 row)