pyinterp.geometry.geographic.algorithms.is_valid#
- pyinterp.geometry.geographic.algorithms.is_valid(geometry: pyinterp.core.geometry.geographic.Point, return_reason: bool = False) object#
- pyinterp.geometry.geographic.algorithms.is_valid(geometry: pyinterp.core.geometry.geographic.Segment, return_reason: bool = False) object
- pyinterp.geometry.geographic.algorithms.is_valid(geometry: pyinterp.core.geometry.geographic.Box, return_reason: bool = False) object
- pyinterp.geometry.geographic.algorithms.is_valid(geometry: pyinterp.core.geometry.geographic.LineString, return_reason: bool = False) object
- pyinterp.geometry.geographic.algorithms.is_valid(geometry: pyinterp.core.geometry.geographic.Ring, return_reason: bool = False) object
- pyinterp.geometry.geographic.algorithms.is_valid(geometry: pyinterp.core.geometry.geographic.Polygon, return_reason: bool = False) object
- pyinterp.geometry.geographic.algorithms.is_valid(geometry: pyinterp.core.geometry.geographic.MultiPoint, return_reason: bool = False) object
- pyinterp.geometry.geographic.algorithms.is_valid(geometry: pyinterp.core.geometry.geographic.MultiLineString, return_reason: bool = False) object
- pyinterp.geometry.geographic.algorithms.is_valid(geometry: pyinterp.core.geometry.geographic.MultiPolygon, return_reason: bool = False) object
Check if a geometry is valid according to OGC standards.
Validity rules (OGC Simple Features specification):
Points: Always valid (unless coordinates are NaN/Inf)
LineStrings: Must have at least 2 points
Rings: Must be closed and have at least 4 points
Polygons: Outer ring must be counter-clockwise, inner rings clockwise, rings must not cross each other or touch except at single points
MultiPolygons: All constituent polygons must be valid
- Parameters:
geometry – Geometric object to check.
- Returns:
- bool
If called without return_reason (
Trueif the geometry is valid, false otherwise.).- tuple[bool, str]
If called with
return_reason=True, returns a tuple where the first element is a boolean indicating validity, and the second element is a string describing the reason for invalidity (empty string if valid).