ST_ISVALID
Introduced or updated: v1.2.911
Returns TRUE if the GEOMETRY object is geometrically valid as defined by the OGC specification.
Syntax
ST_ISVALID(<geometry>)
Arguments
| Arguments | Description |
|---|---|
<geometry> | A GEOMETRY expression. |
Return Type
Boolean.
Examples
SELECT ST_ISVALID(TO_GEOMETRY('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))'));
┌──────────────────────────────────────────────────────────┐
│ st_isvalid(to_geometry('polygon((0 0, 1 0, 1 1, 0 1, 0 0))')) │
├──────────────────────────────────────────────────────────┤
│ true │
└──────────────────────────────────────────────────────────┘
-- Self-intersecting polygon (bowtie shape) is invalid
SELECT ST_ISVALID(TO_GEOMETRY('POLYGON((0 0, 2 2, 2 0, 0 2, 0 0))'));
┌──────────────────────────────────────────────────────────────┐
│ st_isvalid(to_geometry('polygon((0 0, 2 2, 2 0, 0 2, 0 0))')) │
├──────────────────────────────────────────────────────────────┤
│ false │
└──────────────────────────────────────────────────────────────┘