Skip to main content

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

ArgumentsDescription
<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
└──────────────────────────────────────────────────────────────┘
Try Databend Cloud for FREE

Multimodal, object-storage-native warehouse for BI, vectors, search, and geo.

Snowflake-compatible SQL with automatic scaling.

Sign up and get $200 in credits.

Try it today