Skip to content

ST_REVERSE

Reverses the order of vertices in a GEOGRAPHY object, producing an object with the same shape but opposite vertex order.

Syntax

sql
ST_REVERSE(<input>)

Arguments

  • <input>: The GEOGRAPHY object whose vertices will be reversed

Returns

Returns a GEOGRAPHY object with vertices in reversed order.

Example

sql
SELECT ST_AsText(ST_Reverse('LINESTRING(1 1, 2 2, 3 3)'::GEOGRAPHY));
-- 'LINESTRING(3 3, 2 2, 1 1)'