Skip to content
🌵SedonaDB (Rust) 0.3.0 is out now, featuring larger-than-memory spatial joins, and row-level CRS!

ST_IsValidDetail

Introduction: Returns a row, containing a boolean valid stating if a geometry is valid, a string reason stating why it is invalid and a geometry location pointing out where it is invalid.

This function is a combination of ST_IsValid and ST_IsValidReason.

The flags parameter is a bitfield with the following options:

  • 0: Use usual OGC SFS (Simple Features Specification) validity semantics.
  • 1: "ESRI flag", Accepts certain self-touching rings as valid, which are considered invalid under OGC standards.

ST_IsValidDetail

Format:

SELECT valid, reason, Sedonm.ST_AsText(location) AS location
FROM table(Sedona.ST_IsValidDetail(geom: Geometry, flag: Integer))

Return type: Struct<valid: Boolean, reason: String, location: Geometry>

SQL Example:

SELECT valid, reason, Sedonm.ST_AsText(location) AS location
     FROM table(Sedona.ST_IsValidDetail(Sedona.ST_GeomFromWKT('POLYGON ((30 10, 40 40, 20 40, 30 10, 10 20, 30 10))'), 0))

Output:

+-----+---------------------------------------------------------+-------------+
|valid|reason                                                   |location     |
+-----+---------------------------------------------------------+-------------+
|false|Ring Self-intersection at or near point (30.0, 10.0, NaN)|POINT (30 10)|
+-----+---------------------------------------------------------+-------------+