ST_Reverse — Returns the geometry with the vertex order reversed.
geometry ST_Reverse(
bytea
Geometry)
;
Returns the geometry with the vertex order reversed.
2D | 3D | M |
---|---|---|
OGC SFS for SQL. 1.1 (1999) | OGC SFS for SQL. 1.1.0 (2005) | OGC SFS for SQL. 1.2.0 (2006) | SQL-MM Part 3 |
---|---|---|---|
- | - | - | - |
--3D LINESTRING SELECT ST_AsEWKT(G) as original, ST_AsEWKT(ST_Reverse(G)) as reverse from (SELECT ST_GeomFromEWKT('LINESTRING (0 0 15, 10 10 25, 20 10 35)') as G) as foo; original | reverse -----------------------------------------+----------------------------------------- LINESTRING (0 0 15, 10 10 25, 20 10 35) | LINESTRING (20 10 35, 10 10 25, 0 0 15) --MULTILINESTRING SELECT ST_AsEWKT(Reverse(ST_GeomFromEWKT('MULTILINESTRING ((0 0, 10 10, 20 10),(30 30, 40 40, 50 40))'))); --Result MULTILINESTRING ((50 40, 40 40, 30 30), (20 10, 10 10, 0 0)) --GEOMETRYCOLLECTION SELECT ST_AsEWKT(G) as original, ST_AsEWKT(ST_Reverse(G)) as reverse from (SELECT ST_GeomFromEWKT('GEOMETRYCOLLECTION(POINT(2 2),POLYGON ((2 2, 4 2, 2 4, 2 2)))') as G) as foo; original | reverse -----------------------------------------------------------------+----------------------------------------------------------------- GEOMETRYCOLLECTION (POINT (2 2), POLYGON ((2 2, 4 2, 2 4, 2 2))) |GEOMETRYCOLLECTION (POINT (2 2), POLYGON ((2 2, 2 4, 4 2, 2 2)))