GEOS 3.13.1
geos::geom::util::GeometryFixer Class Reference

#include <GeometryFixer.h>

Public Member Functions

 GeometryFixer (const geom::Geometry *p_geom)
void setKeepCollapsed (bool p_isKeepCollapsed)
std::unique_ptr< geom::GeometrygetResult () const

Static Public Member Functions

static std::unique_ptr< geom::Geometryfix (const geom::Geometry *geom)

Detailed Description

Fixes a geometry to be a valid geometry, while preserving as much as possible of the shape and location of the input. Validity is determined according to Geometry#isValid().

Input geometries are always processed, so even valid inputs may have some minor alterations. The output is always a new geometry object.

Semantic Rules

  • Vertices with non-finite X or Y ordinates are removed (as per Coordinate::isValid() ).
    • Repeated points are reduced to a single point
    • Empty atomic geometries are valid and are returned unchanged
    • Empty elements are removed from collections
    • Point: keep valid coordinate, or EMPTY
    • LineString: coordinates are fixed
    • LinearRing: coordinates are fixed, Keep valid ring or else convert into LineString
    • Polygon: transform into a valid polygon,
    • preserving as much of the extent and vertices as possible.
      • Rings are fixed to ensure they are valid<
      • Holes intersecting the shell are subtracted from the shell
      • Holes outside the shell are converted into polygons
    • MultiPolygon: each polygon is fixed, then result made non-overlapping (via union)
    • GeometryCollection: each element is fixed
    • Collapsed lines and polygons are handled as follows, depending on the keepCollapsed setting:
      • false: (default) collapses are converted to empty geometries
      • true: collapses are converted to a valid geometry of lower dimension
Author
Martin Davis

Member Function Documentation

◆ getResult()

std::unique_ptr< geom::Geometry > geos::geom::util::GeometryFixer::getResult ( ) const

Gets the fixed geometry.

Returns
the fixed geometry

◆ setKeepCollapsed()

void geos::geom::util::GeometryFixer::setKeepCollapsed ( bool p_isKeepCollapsed)

Sets whether collapsed geometries are converted to empty, (which will be removed from collections), or to a valid geom::Geometry of lower dimension. The default is to convert collapses to empty geometries.

Parameters
p_isKeepCollapsedwhether collapses should be converted to a lower dimension geometry

The documentation for this class was generated from the following file: