Skip to main content

isValidOrThrow

Asserts whether the geometry is valid. Same as isValid but when geometry is not valid instead of returning false throws an error with the reason of invalidity and with the XY location of the point at which the error occurred. When geometry is valid, it does nothing.

Parameters

NameTypeDefaultDescription
geometryGeometryThe geometry to check
options?objectOptional options object
options.isInvertedRingValid?booleanfalseSets how to treat a polygon with self-touching rings.
If set to true the following self-touching conditions are treated as being valid (ESRI SDE model):
  • inverted shell - the shell ring self-touches to create a hole touching the shell
  • exverted hole - a hole ring self-touches to create two holes touching at a point
If set to false the above conditions, following the OGC SFS standard, are treated as not valid.

Returns

void

Throws

See also

  • isValid checks whether a geometry is valid (true/false)
  • makeValid repairs invalid geometries

Examples