te::gm::Validation Class Reference

#include <Validation.h>

Static Public Member Functions

static bool CheckValidity (const Geometry *geom, te::gm::TopologyValidationError &error)
 It check geometry validity using GEOS. More...
 
static te::gm::GeometryPtr MakeValid (const te::gm::Geometry *geometry)
 
static te::gm::GeometryPtr MakeValid (const te::gm::Geometry *geometry, std::string &errorMessage)
 
static te::gm::GeometryPtr MakeValidWithSnap (const te::gm::Geometry *geometry)
 
static te::gm::GeometryPtr SnapToSelf (const te::gm::Geometry *geometry)
 
static te::gm::GeometryPtr SnapToSelf (const te::gm::Geometry *geometry, double tolerance, bool cleanResult)
 
static te::gm::GeometryValidate (te::gm::Geometry *geom)
 Get/create a valid version of the geometry given. If the geometry is a polygon or multi polygon, self intersections / inconsistencies are fixed. Otherwise the geometry is returned. More...
 

Static Private Member Functions

static te::gm::GeometryPtr MakeValidGeos (const te::gm::Geometry *geometry, std::string &errorMessage)
 
static te::gm::GeometryPtr MakeValidTerralib (const te::gm::Geometry *geometry, std::string &errorMessage)
 Apply several fixes to a geometry to ensure that it will be made valid. New implementations must call MakeValidGeos. More...
 

Detailed Description

Definition at line 61 of file Validation.h.

Member Function Documentation

◆ CheckValidity()

static bool te::gm::Validation::CheckValidity ( const Geometry geom,
te::gm::TopologyValidationError error 
)
static

It check geometry validity using GEOS.

Parameters
geomGeometry that will be verified.
errorTopologyValidationError struct.
Returns
True if geometry is valid.

◆ MakeValid() [1/2]

static te::gm::GeometryPtr te::gm::Validation::MakeValid ( const te::gm::Geometry geometry)
static

Fixes the given geometry. It ensures that all the coordinates will be kept. This algorithm is very conservative. It handles very well polygons containing self intersections like the 8 (eight number) or infinite symbol Important: This may result is some area addition in the cases in which the border of the polygon contains several self touching segments (in both directions) linkng the same area. This situation is usually resulted froma difference operation executed without first snapping both geometries

◆ MakeValid() [2/2]

static te::gm::GeometryPtr te::gm::Validation::MakeValid ( const te::gm::Geometry geometry,
std::string &  errorMessage 
)
static

Fixes the given geometry. It ensures that all the coordinates will be kept. This algorithm is very conservative. It handles very well polygons containing self intersections like the 8 (eight number) or infinite symbol Important: This may result is some area addition in the cases in which the border of the polygon contains several self touching segments (in both directions) linkng the same area. This situation is usually resulted froma difference operation executed without first snapping both geometries

◆ MakeValidGeos()

static te::gm::GeometryPtr te::gm::Validation::MakeValidGeos ( const te::gm::Geometry geometry,
std::string &  errorMessage 
)
staticprivate

◆ MakeValidTerralib()

static te::gm::GeometryPtr te::gm::Validation::MakeValidTerralib ( const te::gm::Geometry geometry,
std::string &  errorMessage 
)
staticprivate

Apply several fixes to a geometry to ensure that it will be made valid. New implementations must call MakeValidGeos.

\description It applies the following fixes: 1 - Removes all the repeated consecutive coordidates 2 - Add perpendicular points that are within the tolerance to each analysed segment 3 - We snap the coordinates to ensure that any "similar" coordinate is now equal 4 - To avoid the discard of rings in geos polygonize function, we must ensure that we removed all the collapsed segments 5 - Finally we applies a polygonizer to recreate the geometry and ensure that it is now consistent

Parameters
geomGeometry that will be verified.
Returns
True if geometry is valid. Executes the makeValid from Geos

◆ MakeValidWithSnap()

static te::gm::GeometryPtr te::gm::Validation::MakeValidWithSnap ( const te::gm::Geometry geometry)
static

Tries to fix a geometry in a better way by combining two algorithms: SnapToSelf and MakeValid It fixes the geometry using the following steps: First try to apply the snapToSelf algorithm. If the result is empty or if the area of the resulting geometry has changed significantly, it assumes that the snapToSelf was not able to fix it appropriately. In this case, it then applies the makeValid algorithm (that is more conservative) and returns the result.

◆ SnapToSelf() [1/2]

static te::gm::GeometryPtr te::gm::Validation::SnapToSelf ( const te::gm::Geometry geometry)
static

Snaps the vertices in the component geom::LineStrings of the source geometry to the vertices of itself with a given snap tolerance and optionally cleaning the result. By GEOS Important: This function may discard the entire geometry and return null if it is not able to execute the operation. It does not handle well polygons containing self intersections like the 8 (eight number) or infinite symbol In this case, choose MakeValid

◆ SnapToSelf() [2/2]

static te::gm::GeometryPtr te::gm::Validation::SnapToSelf ( const te::gm::Geometry geometry,
double  tolerance,
bool  cleanResult 
)
static

Snaps the vertices in the component geom::LineStrings of the source geometry to the vertices of itself with a given snap tolerance and optionally cleaning the result. By GEOS Important: This function may discard the entire geometry and return null if it is not able to execute the operation. It does not handle well polygons containing self intersections like the 8 (eight number) or infinite symbol In this case, choose MakeValid

◆ Validate()

static te::gm::Geometry* te::gm::Validation::Validate ( te::gm::Geometry geom)
static

Get/create a valid version of the geometry given. If the geometry is a polygon or multi polygon, self intersections / inconsistencies are fixed. Otherwise the geometry is returned.

Parameters
geom
Returns
a geometry
Note
: https://stackoverflow.com/questions/31473553/is-there-a-way-to-convert-a-self-intersecting-polygon-to-a-multipolygon-in-jts

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