ST_IsValid¶
Checks whether a geometry meets the rules of a valid spatial object according to the OGC standard.
Usage¶
boolean ST_IsValid(geom: geometry)
Arguments¶
- geom (geometry): Input geometry
Description¶
Returns true if the geometry is well-formed according to OGC rules.
Use ST_IsValidReason to get a diagnostic message for invalid
geometries and ST_MakeValid to attempt to repair them.
Examples¶
SELECT ST_IsValid(
ST_GeomFromText('POLYGON ((0 0, 2 0, 2 2, 1 1, 0 2, 0 0))')
) AS is_valid;
┌──────────┐
│ is_valid │
│ boolean │
╞══════════╡
│ true │
└──────────┘