STV_Reverse
Reverses the order of the vertices of a spatial object.
Behavior Type
Syntax
STV_Reverse( g, [USING PARAMETERS skip_nonreorientable_polygons={true | false} ])
Arguments
g |
Spatial object, type GEOGRAPHY. |
skip_nonreorientable_polygons = { true | false } |
(Optional) Boolean When set to False, non-orientable polygons generate an error. For example, if you use STV_ForceLHR or STV_Reverse with This argument can help you when you are creating an index from a table containing polygons that cannot be re-oriented. Vertica Place considers these polygons non-orientable:
Default value: False |
Returns
GEOGRAPHY
Supported Data Types
Data Type | GEOMETRY | GEOGRAPHY (Perfect Sphere) | GEOGRAPHY (WGS84) |
Point |
No |
No |
No |
Multipoint |
No |
No |
No |
Linestring |
No |
No |
No |
Multilinestring |
No |
No |
No |
Polygon |
No |
Yes |
Yes |
Multipolygon |
No |
Yes |
Yes |
GeometryCollection |
No |
No |
No |
Examples
The following examples show how you can use STV_Reverse.
Reverse vertices of a geography polygon:
=> SELECT ST_AsText(STV_Reverse(ST_GeographyFromText('Polygon((1 1, 3 1, 2 2, 1 1))'))); ST_AsText -------------------------------- POLYGON ((1 1, 2 2, 3 1, 1 1)) (1 row)
Force the polygon to reverse orientation:
=> SELECT ST_AsText(STV_Reverse(ST_GeographyFromText('Polygon((1 1, 2 2, 3 1, 1 1))'))); ST_AsText -------------------------------- POLYGON ((1 1, 3 1, 2 2, 1 1)) (1 row)