Appearance
ST_MAKEVALID
Creates a valid representation of an invalid GEOGRAPHY while preserving all input vertices.
If the input GEOGRAPHY is already valid, it is returned unchanged.
See also:
Syntax
sql
ST_MAKEVALID(<input>)Arguments
<input>: TheGEOGRAPHYobject to be validated
Returns
Returns a valid GEOGRAPHY object. The output may be:
- The same
GEOGRAPHYif the input was already valid - A collection of geographies with equal or lower dimensions
- A
GEOGRAPHYof lower dimension in case of dimensional collapse - A multi-geometry if self-intersections are present
Example
sql
SELECT ST_AsText(ST_MakeValid('POLYGON((1 1, -1 1, 1 -1, -1 -1, 1 1))'::GEOGRAPHY));
-- MULTIPOLYGON(((-1 1,1 1,0 0,-1 1)),((-1 -1,0 0,1 -1,-1 -1)))