QGIS API Documentation 3.40.0-Bratislava (b56115d8743)
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
QgsGeos Class Reference

Does vector analysis using the geos library and handles import, export, exception handling*. More...

#include <qgsgeos.h>

Inheritance diagram for QgsGeos:
Inheritance graph
[legend]

Public Member Functions

 QgsGeos (const QgsAbstractGeometry *geometry, double precision=0, Qgis::GeosCreationFlags flags=Qgis::GeosCreationFlags())
 GEOS geometry engine constructor.
 
double area (QString *errorMsg=nullptr) const override
 
QgsAbstractGeometrybuffer (double distance, int segments, Qgis::EndCapStyle endCapStyle, Qgis::JoinStyle joinStyle, double miterLimit, QString *errorMsg=nullptr) const override
 Buffers a geometry.
 
QgsAbstractGeometrybuffer (double distance, int segments, QString *errorMsg=nullptr) const override
 
QgsPointcentroid (QString *errorMsg=nullptr) const override
 Calculates the centroid of this.
 
std::unique_ptr< QgsAbstractGeometryclip (const QgsRectangle &rectangle, QString *errorMsg=nullptr) const
 Performs a fast, non-robust intersection between the geometry and a rectangle.
 
QgsGeometry closestPoint (const QgsGeometry &other, QString *errorMsg=nullptr) const
 Returns the closest point on the geometry to the other geometry.
 
QgsAbstractGeometrycombine (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr, const QgsGeometryParameters &parameters=QgsGeometryParameters()) const override
 Calculate the combination of this and geom.
 
QgsAbstractGeometrycombine (const QVector< QgsAbstractGeometry * > &geomList, QString *errorMsg, const QgsGeometryParameters &parameters=QgsGeometryParameters()) const override
 Calculate the combination of this and geometries.
 
QgsAbstractGeometrycombine (const QVector< QgsGeometry > &, QString *errorMsg=nullptr, const QgsGeometryParameters &parameters=QgsGeometryParameters()) const override
 Calculate the combination of this and geometries.
 
QgsAbstractGeometryconcaveHull (double targetPercent, bool allowHoles=false, QString *errorMsg=nullptr) const
 Returns a possibly concave geometry that encloses the input geometry.
 
std::unique_ptr< QgsAbstractGeometryconstrainedDelaunayTriangulation (QString *errorMsg=nullptr) const
 Returns a constrained Delaunay triangulation for the vertices of the geometry.
 
bool contains (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const override
 Checks if geom contains this.
 
bool contains (double x, double y, QString *errorMsg=nullptr) const
 Returns true if the geometry contains the point at (x, y).
 
QgsAbstractGeometryconvexHull (QString *errorMsg=nullptr) const override
 Calculate the convex hull of this.
 
bool crosses (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const override
 Checks if geom crosses this.
 
QgsGeometry delaunayTriangulation (double tolerance=0.0, bool edgesOnly=false, QString *errorMsg=nullptr) const
 Returns the Delaunay triangulation for the vertices of the geometry.
 
QgsAbstractGeometrydifference (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr, const QgsGeometryParameters &parameters=QgsGeometryParameters()) const override
 Calculate the difference of this and geom.
 
bool disjoint (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const override
 Checks if geom is disjoint from this.
 
double distance (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const override
 Calculates the distance between this and geom.
 
double distance (double x, double y, QString *errorMsg=nullptr) const
 Returns the minimum distance from the geometry to the point at (x, y).
 
bool distanceWithin (const QgsAbstractGeometry *geom, double maxdistance, QString *errorMsg=nullptr) const override
 Checks if geom is within maxdistance distance from this geometry.
 
QgsAbstractGeometryenvelope (QString *errorMsg=nullptr) const override
 
double frechetDistance (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const
 Returns the Fréchet distance between this geometry and geom, restricted to discrete points for both geometries.
 
double frechetDistanceDensify (const QgsAbstractGeometry *geom, double densifyFraction, QString *errorMsg=nullptr) const
 Returns the Fréchet distance between this geometry and geom, restricted to discrete points for both geometries.
 
void geometryChanged () override
 Should be called whenever the geometry associated with the engine has been modified and the engine must be updated to suit.
 
double hausdorffDistance (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const
 Returns the Hausdorff distance between this geometry and geom.
 
double hausdorffDistanceDensify (const QgsAbstractGeometry *geom, double densifyFraction, QString *errorMsg=nullptr) const
 Returns the Hausdorff distance between this geometry and geom.
 
QgsAbstractGeometryinterpolate (double distance, QString *errorMsg=nullptr) const override
 
QgsAbstractGeometryintersection (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr, const QgsGeometryParameters &parameters=QgsGeometryParameters()) const override
 Calculate the intersection of this and geom.
 
bool intersects (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const override
 Checks if geom intersects this.
 
bool isEmpty (QString *errorMsg=nullptr) const override
 
bool isEqual (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const override
 Checks if this is equal to geom.
 
bool isSimple (QString *errorMsg=nullptr) const override
 Determines whether the geometry is simple (according to OGC definition).
 
bool isValid (QString *errorMsg=nullptr, bool allowSelfTouchingHoles=false, QgsGeometry *errorLoc=nullptr) const override
 Returns true if the geometry is valid.
 
std::unique_ptr< QgsAbstractGeometrylargestEmptyCircle (double tolerance, const QgsAbstractGeometry *boundary=nullptr, QString *errorMsg=nullptr) const
 Constructs the Largest Empty Circle for a set of obstacle geometries, up to a specified tolerance.
 
double length (QString *errorMsg=nullptr) const override
 
double lineLocatePoint (const QgsPoint &point, QString *errorMsg=nullptr) const
 Returns a distance representing the location along this linestring of the closest point on this linestring geometry to the specified point.
 
double lineLocatePoint (double x, double y, QString *errorMsg=nullptr) const
 Returns a distance representing the location along this linestring of the closest point on this linestring geometry to the point at (x, y).
 
std::unique_ptr< QgsAbstractGeometrymakeValid (Qgis::MakeValidMethod method=Qgis::MakeValidMethod::Linework, bool keepCollapsed=false, QString *errorMsg=nullptr) const
 Repairs the geometry using GEOS make valid routine.
 
std::unique_ptr< QgsAbstractGeometrymaximumInscribedCircle (double tolerance, QString *errorMsg=nullptr) const
 Returns the maximum inscribed circle.
 
QgsGeometry mergeLines (QString *errorMsg=nullptr) const
 Merges any connected lines in a LineString/MultiLineString geometry and converts them to single line strings.
 
double minimumClearance (QString *errorMsg=nullptr) const
 Computes the minimum clearance of a geometry.
 
std::unique_ptr< QgsAbstractGeometryminimumClearanceLine (QString *errorMsg=nullptr) const
 Returns a LineString whose endpoints define the minimum clearance of a geometry.
 
std::unique_ptr< QgsAbstractGeometryminimumWidth (QString *errorMsg=nullptr) const
 Returns a linestring geometry which represents the minimum diameter of the geometry.
 
std::unique_ptr< QgsAbstractGeometrynode (QString *errorMsg=nullptr) const
 Returns a (Multi)LineString representing the fully noded version of a collection of linestrings.
 
QgsAbstractGeometryoffsetCurve (double distance, int segments, Qgis::JoinStyle joinStyle, double miterLimit, QString *errorMsg=nullptr) const override
 Offsets a curve.
 
bool overlaps (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const override
 Checks if geom overlaps this.
 
QgsPointpointOnSurface (QString *errorMsg=nullptr) const override
 Calculate a point that is guaranteed to be on the surface of this.
 
void prepareGeometry () override
 Prepares the geometry, so that subsequent calls to spatial relation methods are much faster.
 
QString relate (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const override
 Returns the Dimensional Extended 9 Intersection Model (DE-9IM) representation of the relationship between the geometries.
 
bool relatePattern (const QgsAbstractGeometry *geom, const QString &pattern, QString *errorMsg=nullptr) const override
 Tests whether two geometries are related by a specified Dimensional Extended 9 Intersection Model (DE-9IM) pattern.
 
std::unique_ptr< QgsAbstractGeometryreshapeGeometry (const QgsLineString &reshapeWithLine, EngineOperationResult *errorCode, QString *errorMsg=nullptr) const
 Reshapes the geometry using a line.
 
std::unique_ptr< QgsAbstractGeometrysharedPaths (const QgsAbstractGeometry *other, QString *errorMsg=nullptr) const
 Find paths shared between the two given lineal geometries (this and other).
 
QgsGeometry shortestLine (const QgsAbstractGeometry *other, QString *errorMsg=nullptr) const
 Returns the shortest line joining this geometry to the other geometry.
 
QgsGeometry shortestLine (const QgsGeometry &other, QString *errorMsg=nullptr) const
 Returns the shortest line joining this geometry to the other geometry.
 
QgsAbstractGeometrysimplify (double tolerance, QString *errorMsg=nullptr) const override
 
std::unique_ptr< QgsAbstractGeometrysimplifyCoverageVW (double tolerance, bool preserveBoundary, QString *errorMsg=nullptr) const
 Operates on a coverage (represented as a list of polygonal geometry with exactly matching edge geometry) to apply a Visvalingam–Whyatt simplification to the edges, reducing complexity in proportion with the provided tolerance, while retaining a valid coverage (no edges will cross or touch after the simplification).
 
std::unique_ptr< QgsAbstractGeometrysingleSidedBuffer (double distance, int segments, Qgis::BufferSide side, Qgis::JoinStyle joinStyle, double miterLimit, QString *errorMsg=nullptr) const
 Returns a single sided buffer for a geometry.
 
EngineOperationResult splitGeometry (const QgsLineString &splitLine, QVector< QgsGeometry > &newGeometries, bool topological, QgsPointSequence &topologyTestPoints, QString *errorMsg=nullptr, bool skipIntersectionCheck=false) const override
 Splits this geometry according to a given line.
 
std::unique_ptr< QgsAbstractGeometrysubdivide (int maxNodes, QString *errorMsg=nullptr, const QgsGeometryParameters &parameters=QgsGeometryParameters()) const
 Subdivides the geometry.
 
QgsAbstractGeometrysymDifference (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr, const QgsGeometryParameters &parameters=QgsGeometryParameters()) const override
 Calculate the symmetric difference of this and geom.
 
bool touches (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const override
 Checks if geom touches this.
 
std::unique_ptr< QgsAbstractGeometryunionCoverage (QString *errorMsg=nullptr) const
 Optimized union algorithm for polygonal inputs that are correctly noded and do not overlap.
 
Qgis::CoverageValidityResult validateCoverage (double gapWidth, std::unique_ptr< QgsAbstractGeometry > *invalidEdges, QString *errorMsg=nullptr) const
 Analyze a coverage (represented as a collection of polygonal geometry with exactly matching edge geometry) to find places where the assumption of exactly matching edges is not met.
 
QgsGeometry voronoiDiagram (const QgsAbstractGeometry *extent=nullptr, double tolerance=0.0, bool edgesOnly=false, QString *errorMsg=nullptr) const
 Creates a Voronoi diagram for the nodes contained within the geometry.
 
bool within (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const override
 Checks if geom is within this.
 
- Public Member Functions inherited from QgsGeometryEngine
virtual ~QgsGeometryEngine ()=default
 
void setLogErrors (bool enabled)
 Sets whether warnings and errors encountered during the geometry operations should be logged.
 

Static Public Member Functions

static Qgis::GeometryOperationResult addPart (QgsGeometry &geometry, GEOSGeometry *newPart)
 Adds a new island polygon to a multipolygon feature.
 
static geos::unique_ptr asGeos (const QgsAbstractGeometry *geometry, double precision=0, Qgis::GeosCreationFlags flags=Qgis::GeosCreationFlags())
 Returns a geos geometry - caller takes ownership of the object (should be deleted with GEOSGeom_destroy_r)
 
static geos::unique_ptr asGeos (const QgsGeometry &geometry, double precision=0, Qgis::GeosCreationFlags flags=Qgis::GeosCreationFlags())
 Returns a geos geometry - caller takes ownership of the object (should be deleted with GEOSGeom_destroy_r)
 
static QgsPoint coordSeqPoint (const GEOSCoordSequence *cs, int i, bool hasZ, bool hasM)
 
static std::unique_ptr< QgsAbstractGeometryfromGeos (const GEOSGeometry *geos)
 Create a geometry from a GEOSGeometry.
 
static std::unique_ptr< QgsPolygonfromGeosPolygon (const GEOSGeometry *geos)
 
static QgsGeometry geometryFromGeos (const geos::unique_ptr &geos)
 Creates a new QgsGeometry object, feeding in a geometry in GEOS format.
 
static QgsGeometry geometryFromGeos (GEOSGeometry *geos)
 Creates a new QgsGeometry object, feeding in a geometry in GEOS format.
 
static QgsGeometry polygonize (const QVector< const QgsAbstractGeometry * > &geometries, QString *errorMsg=nullptr)
 Creates a GeometryCollection geometry containing possible polygons formed from the constituent linework of a set of geometries.
 

Additional Inherited Members

- Public Types inherited from QgsGeometryEngine
enum  EngineOperationResult {
  Success = 0 , NothingHappened = 1000 , MethodNotImplemented , EngineError ,
  NodedGeometryError , InvalidBaseGeometry , InvalidInput , SplitCannotSplitPoint
}
 Success or failure of a geometry operation. More...
 
- Protected Member Functions inherited from QgsGeometryEngine
 QgsGeometryEngine (const QgsAbstractGeometry *geometry)
 
void logError (const QString &engineName, const QString &message) const
 Logs an error message encountered during an operation.
 
- Protected Attributes inherited from QgsGeometryEngine
const QgsAbstractGeometrymGeometry = nullptr
 
bool mLogErrors = true
 

Detailed Description

Does vector analysis using the geos library and handles import, export, exception handling*.

Note
not available in Python bindings

Definition at line 136 of file qgsgeos.h.

Constructor & Destructor Documentation

◆ QgsGeos()

QgsGeos::QgsGeos ( const QgsAbstractGeometry geometry,
double  precision = 0,
Qgis::GeosCreationFlags  flags = Qgis::GeosCreationFlags() 
)

GEOS geometry engine constructor.

Parameters
geometryThe geometry
precisionThe precision of the grid to which to snap the geometry vertices. If 0, no snapping is performed.
flagsGEOS creation flags (since QGIS 3.40)
Note
The third parameter was prior to QGIS 3.40 a boolean which has been incorporated into the flag

Definition at line 177 of file qgsgeos.cpp.

Member Function Documentation

◆ addPart()

Qgis::GeometryOperationResult QgsGeos::addPart ( QgsGeometry geometry,
GEOSGeometry newPart 
)
static

Adds a new island polygon to a multipolygon feature.

Parameters
geometrygeometry to add part to
newPartpart to add. Ownership is NOT transferred.
Returns
OperationResult a result code: success or reason of failure

Definition at line 267 of file qgsgeos.cpp.

◆ area()

double QgsGeos::area ( QString *  errorMsg = nullptr) const
overridevirtual

Implements QgsGeometryEngine.

Definition at line 1007 of file qgsgeos.cpp.

◆ asGeos() [1/2]

geos::unique_ptr QgsGeos::asGeos ( const QgsAbstractGeometry geometry,
double  precision = 0,
Qgis::GeosCreationFlags  flags = Qgis::GeosCreationFlags() 
)
static

Returns a geos geometry - caller takes ownership of the object (should be deleted with GEOSGeom_destroy_r)

Parameters
geometrygeometry to convert to GEOS representation
precisionThe precision of the grid to which to snap the geometry vertices. If 0, no snapping is performed.
flagsGEOS creation flags (since QGIS 3.40)
Note
The third parameter was prior to QGIS 3.40 a boolean which has been incorporated into the flag

Definition at line 1799 of file qgsgeos.cpp.

◆ asGeos() [2/2]

geos::unique_ptr QgsGeos::asGeos ( const QgsGeometry geometry,
double  precision = 0,
Qgis::GeosCreationFlags  flags = Qgis::GeosCreationFlags() 
)
static

Returns a geos geometry - caller takes ownership of the object (should be deleted with GEOSGeom_destroy_r)

Parameters
geometrygeometry to convert to GEOS representation
precisionThe precision of the grid to which to snap the geometry vertices. If 0, no snapping is performed.
flagsGEOS creation flags (since QGIS 3.40)

Definition at line 257 of file qgsgeos.cpp.

◆ buffer() [1/2]

QgsAbstractGeometry * QgsGeos::buffer ( double  distance,
int  segments,
Qgis::EndCapStyle  endCapStyle,
Qgis::JoinStyle  joinStyle,
double  miterLimit,
QString *  errorMsg = nullptr 
) const
overridevirtual

Buffers a geometry.

Implements QgsGeometryEngine.

Definition at line 2095 of file qgsgeos.cpp.

◆ buffer() [2/2]

QgsAbstractGeometry * QgsGeos::buffer ( double  distance,
int  segments,
QString *  errorMsg = nullptr 
) const
overridevirtual

Implements QgsGeometryEngine.

Definition at line 2079 of file qgsgeos.cpp.

◆ centroid()

QgsPoint * QgsGeos::centroid ( QString *  errorMsg = nullptr) const
overridevirtual

Calculates the centroid of this.

May return a \c nullptr.

Implements QgsGeometryEngine.

Definition at line 2141 of file qgsgeos.cpp.

◆ clip()

std::unique_ptr< QgsAbstractGeometry > QgsGeos::clip ( const QgsRectangle rectangle,
QString *  errorMsg = nullptr 
) const

Performs a fast, non-robust intersection between the geometry and a rectangle.

The returned geometry may be invalid.

Definition at line 327 of file qgsgeos.cpp.

◆ closestPoint()

QgsGeometry QgsGeos::closestPoint ( const QgsGeometry other,
QString *  errorMsg = nullptr 
) const

Returns the closest point on the geometry to the other geometry.

See also
shortestLine()

Definition at line 3051 of file qgsgeos.cpp.

◆ combine() [1/3]

QgsAbstractGeometry * QgsGeos::combine ( const QgsAbstractGeometry geom,
QString *  errorMsg = nullptr,
const QgsGeometryParameters parameters = QgsGeometryParameters() 
) const
overridevirtual

Calculate the combination of this and geom.

Parameters
geomgeometry to perform the operation
errorMsgError message returned by GEOS
parameterscan be used to specify parameters which control the union results (since QGIS 3.28)

Implements QgsGeometryEngine.

Definition at line 468 of file qgsgeos.cpp.

◆ combine() [2/3]

QgsAbstractGeometry * QgsGeos::combine ( const QVector< QgsAbstractGeometry * > &  geomList,
QString *  errorMsg,
const QgsGeometryParameters parameters = QgsGeometryParameters() 
) const
overridevirtual

Calculate the combination of this and geometries.

Parameters
geomListlist of geometries to perform the operation
errorMsgError message returned by GEOS
parameterscan be used to specify parameters which control the combination results (since QGIS 3.28)

Implements QgsGeometryEngine.

Definition at line 473 of file qgsgeos.cpp.

◆ combine() [3/3]

QgsAbstractGeometry * QgsGeos::combine ( const QVector< QgsGeometry > &  geometries,
QString *  errorMsg = nullptr,
const QgsGeometryParameters parameters = QgsGeometryParameters() 
) const
overridevirtual

Calculate the combination of this and geometries.

Parameters
geometrieslist of geometries to perform the operation
errorMsgError message returned by GEOS
parameterscan be used to specify parameters which control the combination results (since QGIS 3.28)

Implements QgsGeometryEngine.

Definition at line 505 of file qgsgeos.cpp.

◆ concaveHull()

QgsAbstractGeometry * QgsGeos::concaveHull ( double  targetPercent,
bool  allowHoles = false,
QString *  errorMsg = nullptr 
) const

Returns a possibly concave geometry that encloses the input geometry.

The result is a single polygon, line or point.

It will not contain holes unless the optional allowHoles argument is specified as true.

One can think of a concave hull as a geometry obtained by "shrink-wrapping" a set of geometries. This is different to the convex hull, which is more like wrapping a rubber band around the geometries. It is slower to compute than the convex hull but generally has a smaller area and represents a more natural boundary for the input geometry. The target_percent is the percentage of area of the convex hull the solution tries to approach.

A target_percent of 1 gives the same result as the convex hull. A target_percent between 0 and 0.99 produces a result that should have a smaller area than the convex hull.

This method requires a QGIS build based on GEOS 3.11 or later.

Exceptions
QgsNotSupportedExceptionon QGIS builds based on GEOS 3.10 or earlier.
See also
convexHull()
Since
QGIS 3.28

Definition at line 2228 of file qgsgeos.cpp.

◆ constrainedDelaunayTriangulation()

std::unique_ptr< QgsAbstractGeometry > QgsGeos::constrainedDelaunayTriangulation ( QString *  errorMsg = nullptr) const

Returns a constrained Delaunay triangulation for the vertices of the geometry.

An empty geometry will be returned if the triangulation could not be calculated.

This method requires a QGIS build based on GEOS 3.11 or later.

Exceptions
QgsNotSupportedExceptionon QGIS builds based on GEOS 3.10 or earlier.
See also
delaunayTriangulation()
Since
QGIS 3.36

Definition at line 3309 of file qgsgeos.cpp.

◆ contains() [1/2]

bool QgsGeos::contains ( const QgsAbstractGeometry geom,
QString *  errorMsg = nullptr 
) const
overridevirtual

Checks if geom contains this.

Implements QgsGeometryEngine.

Definition at line 902 of file qgsgeos.cpp.

◆ contains() [2/2]

bool QgsGeos::contains ( double  x,
double  y,
QString *  errorMsg = nullptr 
) const

Returns true if the geometry contains the point at (x, y).

This method is more efficient than creating a temporary QgsPoint object to test for containment.

Since
QGIS 3.26

Definition at line 714 of file qgsgeos.cpp.

◆ convexHull()

QgsAbstractGeometry * QgsGeos::convexHull ( QString *  errorMsg = nullptr) const
overridevirtual

Calculate the convex hull of this.

Implements QgsGeometryEngine.

Definition at line 2212 of file qgsgeos.cpp.

◆ coordSeqPoint()

QgsPoint QgsGeos::coordSeqPoint ( const GEOSCoordSequence *  cs,
int  i,
bool  hasZ,
bool  hasM 
)
static

Definition at line 1762 of file qgsgeos.cpp.

◆ crosses()

bool QgsGeos::crosses ( const QgsAbstractGeometry geom,
QString *  errorMsg = nullptr 
) const
overridevirtual

Checks if geom crosses this.

Implements QgsGeometryEngine.

Definition at line 887 of file qgsgeos.cpp.

◆ delaunayTriangulation()

QgsGeometry QgsGeos::delaunayTriangulation ( double  tolerance = 0.0,
bool  edgesOnly = false,
QString *  errorMsg = nullptr 
) const

Returns the Delaunay triangulation for the vertices of the geometry.

The tolerance parameter specifies an optional snapping tolerance which can be used to improve the robustness of the triangulation. If edgesOnly is true than line string boundary geometries will be returned instead of polygons. An empty geometry will be returned if the diagram could not be calculated.

See also
constrainedDelaunayTriangulation()

Definition at line 3286 of file qgsgeos.cpp.

◆ difference()

QgsAbstractGeometry * QgsGeos::difference ( const QgsAbstractGeometry geom,
QString *  errorMsg = nullptr,
const QgsGeometryParameters parameters = QgsGeometryParameters() 
) const
overridevirtual

Calculate the difference of this and geom.

Parameters
geomgeometry to perform the operation
errorMsgError message returned by GEOS
parameterscan be used to specify parameters which control the difference results (since QGIS 3.28)

Implements QgsGeometryEngine.

Definition at line 322 of file qgsgeos.cpp.

◆ disjoint()

bool QgsGeos::disjoint ( const QgsAbstractGeometry geom,
QString *  errorMsg = nullptr 
) const
overridevirtual

Checks if geom is disjoint from this.

Implements QgsGeometryEngine.

Definition at line 935 of file qgsgeos.cpp.

◆ distance() [1/2]

double QgsGeos::distance ( const QgsAbstractGeometry geom,
QString *  errorMsg = nullptr 
) const
overridevirtual

Calculates the distance between this and geom.

Implements QgsGeometryEngine.

Definition at line 581 of file qgsgeos.cpp.

◆ distance() [2/2]

double QgsGeos::distance ( double  x,
double  y,
QString *  errorMsg = nullptr 
) const

Returns the minimum distance from the geometry to the point at (x, y).

This method is more efficient than creating a temporary QgsPoint object to test distance.

Since
QGIS 3.26

Definition at line 627 of file qgsgeos.cpp.

◆ distanceWithin()

bool QgsGeos::distanceWithin ( const QgsAbstractGeometry geom,
double  maxdistance,
QString *  errorMsg = nullptr 
) const
overridevirtual

Checks if geom is within maxdistance distance from this geometry.

Since
QGIS 3.22

Implements QgsGeometryEngine.

Definition at line 656 of file qgsgeos.cpp.

◆ envelope()

QgsAbstractGeometry * QgsGeos::envelope ( QString *  errorMsg = nullptr) const
overridevirtual

Implements QgsGeometryEngine.

Definition at line 2168 of file qgsgeos.cpp.

◆ frechetDistance()

double QgsGeos::frechetDistance ( const QgsAbstractGeometry geom,
QString *  errorMsg = nullptr 
) const

Returns the Fréchet distance between this geometry and geom, restricted to discrete points for both geometries.

The Fréchet distance is a measure of similarity between curves that takes into account the location and ordering of the points along the curves. Therefore it is often better than the Hausdorff distance.

This method requires a QGIS build based on GEOS 3.7 or later.

Exceptions
QgsNotSupportedExceptionon QGIS builds based on GEOS 3.6 or earlier.
See also
frechetDistanceDensify()
Since
QGIS 3.20

Definition at line 803 of file qgsgeos.cpp.

◆ frechetDistanceDensify()

double QgsGeos::frechetDistanceDensify ( const QgsAbstractGeometry geom,
double  densifyFraction,
QString *  errorMsg = nullptr 
) const

Returns the Fréchet distance between this geometry and geom, restricted to discrete points for both geometries.

The Fréchet distance is a measure of similarity between curves that takes into account the location and ordering of the points along the curves. Therefore it is often better than the Hausdorff distance.

This function accepts a densifyFraction argument. The function performs a segment densification before computing the discrete Fréchet distance. The densifyFraction parameter sets the fraction by which to densify each segment. Each segment will be split into a number of equal-length subsegments, whose fraction of the total length is closest to the given fraction.

This method can be used when the default approximation provided by frechetDistance() is not sufficient. Decreasing the densifyFraction parameter will make the distance returned approach the true Fréchet distance for the geometries.

This method requires a QGIS build based on GEOS 3.7 or later.

Exceptions
QgsNotSupportedExceptionon QGIS builds based on GEOS 3.6 or earlier.
See also
frechetDistance()
Since
QGIS 3.20

Definition at line 826 of file qgsgeos.cpp.

◆ fromGeos()

std::unique_ptr< QgsAbstractGeometry > QgsGeos::fromGeos ( const GEOSGeometry geos)
static

Create a geometry from a GEOSGeometry.

Parameters
geosGEOSGeometry. Ownership is NOT transferred.

Definition at line 1568 of file qgsgeos.cpp.

◆ fromGeosPolygon()

std::unique_ptr< QgsPolygon > QgsGeos::fromGeosPolygon ( const GEOSGeometry geos)
static

Definition at line 1669 of file qgsgeos.cpp.

◆ geometryChanged()

void QgsGeos::geometryChanged ( )
overridevirtual

Should be called whenever the geometry associated with the engine has been modified and the engine must be updated to suit.

Implements QgsGeometryEngine.

Definition at line 282 of file qgsgeos.cpp.

◆ geometryFromGeos() [1/2]

QgsGeometry QgsGeos::geometryFromGeos ( const geos::unique_ptr &  geos)
static

Creates a new QgsGeometry object, feeding in a geometry in GEOS format.

Definition at line 192 of file qgsgeos.cpp.

◆ geometryFromGeos() [2/2]

QgsGeometry QgsGeos::geometryFromGeos ( GEOSGeometry geos)
static

Creates a new QgsGeometry object, feeding in a geometry in GEOS format.

This class will take ownership of the buffer.

Definition at line 185 of file qgsgeos.cpp.

◆ hausdorffDistance()

double QgsGeos::hausdorffDistance ( const QgsAbstractGeometry geom,
QString *  errorMsg = nullptr 
) const

Returns the Hausdorff distance between this geometry and geom.

This is basically a measure of how similar or dissimilar 2 geometries are.

This algorithm is an approximation to the standard Hausdorff distance. This approximation is exact or close enough for a large subset of useful cases. Examples of these are:

  • computing distance between Linestrings that are roughly parallel to each other, and roughly equal in length. This occurs in matching linear networks.
  • Testing similarity of geometries.

If the default approximate provided by this method is insufficient, use hausdorffDistanceDensify() instead.

See also
hausdorffDistanceDensify()

Definition at line 757 of file qgsgeos.cpp.

◆ hausdorffDistanceDensify()

double QgsGeos::hausdorffDistanceDensify ( const QgsAbstractGeometry geom,
double  densifyFraction,
QString *  errorMsg = nullptr 
) const

Returns the Hausdorff distance between this geometry and geom.

This is basically a measure of how similar or dissimilar 2 geometries are.

This function accepts a densifyFraction argument. The function performs a segment densification before computing the discrete Hausdorff distance. The densifyFraction parameter sets the fraction by which to densify each segment. Each segment will be split into a number of equal-length subsegments, whose fraction of the total length is closest to the given fraction.

This method can be used when the default approximation provided by hausdorffDistance() is not sufficient. Decreasing the densifyFraction parameter will make the distance returned approach the true Hausdorff distance for the geometries.

See also
hausdorffDistance()

Definition at line 780 of file qgsgeos.cpp.

◆ interpolate()

QgsAbstractGeometry * QgsGeos::interpolate ( double  distance,
QString *  errorMsg = nullptr 
) const
overridevirtual

Implements QgsGeometryEngine.

Definition at line 2126 of file qgsgeos.cpp.

◆ intersection()

QgsAbstractGeometry * QgsGeos::intersection ( const QgsAbstractGeometry geom,
QString *  errorMsg = nullptr,
const QgsGeometryParameters parameters = QgsGeometryParameters() 
) const
overridevirtual

Calculate the intersection of this and geom.

Parameters
geomgeometry to perform the operation
errorMsgError message returned by GEOS
parameterscan be used to specify parameters which control the intersection results (since QGIS 3.28)

Implements QgsGeometryEngine.

Definition at line 317 of file qgsgeos.cpp.

◆ intersects()

bool QgsGeos::intersects ( const QgsAbstractGeometry geom,
QString *  errorMsg = nullptr 
) const
overridevirtual

Checks if geom intersects this.

Implements QgsGeometryEngine.

Definition at line 849 of file qgsgeos.cpp.

◆ isEmpty()

bool QgsGeos::isEmpty ( QString *  errorMsg = nullptr) const
overridevirtual

Implements QgsGeometryEngine.

Definition at line 2422 of file qgsgeos.cpp.

◆ isEqual()

bool QgsGeos::isEqual ( const QgsAbstractGeometry geom,
QString *  errorMsg = nullptr 
) const
overridevirtual

Checks if this is equal to geom.

If both are Null geometries, \c false is returned.

Implements QgsGeometryEngine.

Definition at line 2402 of file qgsgeos.cpp.

◆ isSimple()

bool QgsGeos::isSimple ( QString *  errorMsg = nullptr) const
overridevirtual

Determines whether the geometry is simple (according to OGC definition).

Implements QgsGeometryEngine.

Definition at line 2436 of file qgsgeos.cpp.

◆ isValid()

bool QgsGeos::isValid ( QString *  errorMsg = nullptr,
bool  allowSelfTouchingHoles = false,
QgsGeometry errorLoc = nullptr 
) const
overridevirtual

Returns true if the geometry is valid.

If the geometry is invalid, errorMsg will be filled with the reported geometry error.

The allowSelfTouchingHoles argument specifies whether self-touching holes are permitted. OGC validity states that self-touching holes are NOT permitted, whilst other vendor validity checks (e.g. ESRI) permit self-touching holes.

If errorLoc is specified, it will be set to the geometry of the error location.

Implements QgsGeometryEngine.

Definition at line 2339 of file qgsgeos.cpp.

◆ largestEmptyCircle()

std::unique_ptr< QgsAbstractGeometry > QgsGeos::largestEmptyCircle ( double  tolerance,
const QgsAbstractGeometry boundary = nullptr,
QString *  errorMsg = nullptr 
) const

Constructs the Largest Empty Circle for a set of obstacle geometries, up to a specified tolerance.

The Largest Empty Circle is the largest circle which has its center in the convex hull of the obstacles (the boundary), and whose interior does not intersect with any obstacle. The circle center is the point in the interior of the boundary which has the farthest distance from the obstacles (up to tolerance). The circle is determined by the center point and a point lying on an obstacle indicating the circle radius. The implementation uses a successive-approximation technique over a grid of square cells covering the obstacles and boundary. The grid is refined using a branch-and-bound algorithm. Point containment and distance are computed in a performant way by using spatial indexes. Returns a two-point linestring, with one point at the center of the inscribed circle and the other on the boundary of the inscribed circle.

This method requires a QGIS build based on GEOS 3.9 or later.

Warning
the tolerance value must be a value greater than 0, or the algorithm may never converge on a solution
Exceptions
QgsNotSupportedExceptionon QGIS builds based on GEOS 3.8 or earlier.
Since
QGIS 3.20

Definition at line 2808 of file qgsgeos.cpp.

◆ length()

double QgsGeos::length ( QString *  errorMsg = nullptr) const
overridevirtual

Implements QgsGeometryEngine.

Definition at line 1024 of file qgsgeos.cpp.

◆ lineLocatePoint() [1/2]

double QgsGeos::lineLocatePoint ( const QgsPoint point,
QString *  errorMsg = nullptr 
) const

Returns a distance representing the location along this linestring of the closest point on this linestring geometry to the specified point.

Ie, the returned value indicates how far along this linestring you need to traverse to get to the closest location where this linestring comes to the specified point.

Parameters
pointpoint to seek proximity to
errorMsgerror messages emitted, if any
Returns
distance along line, or -1 on error
Note
only valid for linestring geometries

Definition at line 3153 of file qgsgeos.cpp.

◆ lineLocatePoint() [2/2]

double QgsGeos::lineLocatePoint ( double  x,
double  y,
QString *  errorMsg = nullptr 
) const

Returns a distance representing the location along this linestring of the closest point on this linestring geometry to the point at (x, y).

Ie, the returned value indicates how far along this linestring you need to traverse to get to the closest location where this linestring comes to the specified point.

This method is more efficient than creating a temporary QgsPoint object to locate.

Note
only valid for linestring geometries
Since
QGIS 3.26

Definition at line 3184 of file qgsgeos.cpp.

◆ makeValid()

std::unique_ptr< QgsAbstractGeometry > QgsGeos::makeValid ( Qgis::MakeValidMethod  method = Qgis::MakeValidMethod::Linework,
bool  keepCollapsed = false,
QString *  errorMsg = nullptr 
) const

Repairs the geometry using GEOS make valid routine.

The method and keepCollapsed arguments require builds based on GEOS 3.10 or later.

Exceptions
QgsNotSupportedExceptionon QGIS builds based on GEOS 3.9 or earlier when the method is not Qgis::MakeValidMethod::Linework or the keepCollapsed option is set.
Since
QGIS 3.20

Definition at line 198 of file qgsgeos.cpp.

◆ maximumInscribedCircle()

std::unique_ptr< QgsAbstractGeometry > QgsGeos::maximumInscribedCircle ( double  tolerance,
QString *  errorMsg = nullptr 
) const

Returns the maximum inscribed circle.

Constructs the Maximum Inscribed Circle for a polygonal geometry, up to a specified tolerance. The Maximum Inscribed Circle is determined by a point in the interior of the area which has the farthest distance from the area boundary, along with a boundary point at that distance. In the context of geography the center of the Maximum Inscribed Circle is known as the Pole of Inaccessibility. A cartographic use case is to determine a suitable point to place a map label within a polygon. The radius length of the Maximum Inscribed Circle is a measure of how "narrow" a polygon is. It is the distance at which the negative buffer becomes empty. The class supports polygons with holes and multipolygons. The implementation uses a successive-approximation technique over a grid of square cells covering the area geometry. The grid is refined using a branch-and-bound algorithm. Point containment and distance are computed in a performant way by using spatial indexes. Returns a two-point linestring, with one point at the center of the inscribed circle and the other on the boundary of the inscribed circle.

This method requires a QGIS build based on GEOS 3.9 or later.

Exceptions
QgsNotSupportedExceptionon QGIS builds based on GEOS 3.8 or earlier.
Since
QGIS 3.20

Definition at line 2792 of file qgsgeos.cpp.

◆ mergeLines()

QgsGeometry QgsGeos::mergeLines ( QString *  errorMsg = nullptr) const

Merges any connected lines in a LineString/MultiLineString geometry and converts them to single line strings.

Parameters
errorMsgif specified, will be set to any reported GEOS errors
Returns
a LineString or MultiLineString geometry, with any connected lines joined. An empty geometry will be returned if the input geometry was not a LineString/MultiLineString geometry.

Definition at line 3031 of file qgsgeos.cpp.

◆ minimumClearance()

double QgsGeos::minimumClearance ( QString *  errorMsg = nullptr) const

Computes the minimum clearance of a geometry.

The minimum clearance is the smallest amount by which a vertex could be moved to produce an invalid polygon, a non-simple linestring, or a multipoint with repeated points. If a geometry has a minimum clearance of 'eps', it can be said that:

  • No two distinct vertices in the geometry are separated by less than 'eps'
  • No vertex is closer than 'eps' to a line segment of which it is not an endpoint.

If the minimum clearance cannot be defined for a geometry (such as with a single point, or a multipoint whose points are identical) a value of infinity will be returned.

If an error occurs while calculating the clearance NaN will be returned.

This method requires a QGIS build based on GEOS 3.6 or later.

Exceptions
QgsNotSupportedExceptionon QGIS builds based on GEOS 3.5 or earlier.
Since
QGIS 3.20

Definition at line 2844 of file qgsgeos.cpp.

◆ minimumClearanceLine()

std::unique_ptr< QgsAbstractGeometry > QgsGeos::minimumClearanceLine ( QString *  errorMsg = nullptr) const

Returns a LineString whose endpoints define the minimum clearance of a geometry.

If the geometry has no minimum clearance, an empty LineString will be returned.

This method requires a QGIS build based on GEOS 3.6 or later.

Exceptions
QgsNotSupportedExceptionon QGIS builds based on GEOS 3.5 or earlier.
Since
QGIS 3.20

Definition at line 2862 of file qgsgeos.cpp.

◆ minimumWidth()

std::unique_ptr< QgsAbstractGeometry > QgsGeos::minimumWidth ( QString *  errorMsg = nullptr) const

Returns a linestring geometry which represents the minimum diameter of the geometry.

The minimum diameter is defined to be the width of the smallest band that contains the geometry, where a band is a strip of the plane defined by two parallel lines. This can be thought of as the smallest hole that the geometry can be moved through, with a single rotation.

This method requires a QGIS build based on GEOS 3.6 or later.

Exceptions
QgsNotSupportedExceptionon QGIS builds based on GEOS 3.5 or earlier.
Since
QGIS 3.20

Definition at line 2828 of file qgsgeos.cpp.

◆ node()

std::unique_ptr< QgsAbstractGeometry > QgsGeos::node ( QString *  errorMsg = nullptr) const

Returns a (Multi)LineString representing the fully noded version of a collection of linestrings.

The noding preserves all of the input nodes, and introduces the least possible number of new nodes. The resulting linework is dissolved (duplicate lines are removed).

The input geometry type should be a (Multi)LineString.

Since
QGIS 3.20

Definition at line 2878 of file qgsgeos.cpp.

◆ offsetCurve()

QgsAbstractGeometry * QgsGeos::offsetCurve ( double  distance,
int  segments,
Qgis::JoinStyle  joinStyle,
double  miterLimit,
QString *  errorMsg = nullptr 
) const
overridevirtual

Offsets a curve.

Implements QgsGeometryEngine.

Definition at line 2746 of file qgsgeos.cpp.

◆ overlaps()

bool QgsGeos::overlaps ( const QgsAbstractGeometry geom,
QString *  errorMsg = nullptr 
) const
overridevirtual

Checks if geom overlaps this.

Implements QgsGeometryEngine.

Definition at line 897 of file qgsgeos.cpp.

◆ pointOnSurface()

QgsPoint * QgsGeos::pointOnSurface ( QString *  errorMsg = nullptr) const
overridevirtual

Calculate a point that is guaranteed to be on the surface of this.

May return a \c nullptr.

Implements QgsGeometryEngine.

Definition at line 2183 of file qgsgeos.cpp.

◆ polygonize()

QgsGeometry QgsGeos::polygonize ( const QVector< const QgsAbstractGeometry * > &  geometries,
QString *  errorMsg = nullptr 
)
static

Creates a GeometryCollection geometry containing possible polygons formed from the constituent linework of a set of geometries.

The input geometries must be fully noded (i.e. nodes exist at every common intersection of the geometries). The easiest way to ensure this is to first unary union these geometries by calling combine() on the set of input geometries and then pass the result to polygonize(). An empty geometry will be returned in the case of errors.

Definition at line 3213 of file qgsgeos.cpp.

◆ prepareGeometry()

void QgsGeos::prepareGeometry ( )
overridevirtual

Prepares the geometry, so that subsequent calls to spatial relation methods are much faster.

This should be called for any geometry which is used for multiple relation tests against other geometries.

See also
geometryChanged()

Implements QgsGeometryEngine.

Definition at line 289 of file qgsgeos.cpp.

◆ relate()

QString QgsGeos::relate ( const QgsAbstractGeometry geom,
QString *  errorMsg = nullptr 
) const
overridevirtual

Returns the Dimensional Extended 9 Intersection Model (DE-9IM) representation of the relationship between the geometries.

Parameters
geomgeometry to relate to
errorMsgdestination storage for any error message
Returns
DE-9IM string for relationship, or an empty string if an error occurred

Implements QgsGeometryEngine.

Definition at line 940 of file qgsgeos.cpp.

◆ relatePattern()

bool QgsGeos::relatePattern ( const QgsAbstractGeometry geom,
const QString &  pattern,
QString *  errorMsg = nullptr 
) const
overridevirtual

Tests whether two geometries are related by a specified Dimensional Extended 9 Intersection Model (DE-9IM) pattern.

Parameters
geomgeometry to relate to
patternDE-9IM pattern for match
errorMsgdestination storage for any error message
Returns
true if geometry relationship matches with pattern

Implements QgsGeometryEngine.

Definition at line 976 of file qgsgeos.cpp.

◆ reshapeGeometry()

std::unique_ptr< QgsAbstractGeometry > QgsGeos::reshapeGeometry ( const QgsLineString reshapeWithLine,
EngineOperationResult errorCode,
QString *  errorMsg = nullptr 
) const

Reshapes the geometry using a line.

Parameters
reshapeWithLinethe line used to reshape lines or polygons
errorCodeif specified, provides result of operation (success or reason of failure)
errorMsgif specified, provides more details about failure
Returns
the reshaped geometry

Definition at line 2914 of file qgsgeos.cpp.

◆ sharedPaths()

std::unique_ptr< QgsAbstractGeometry > QgsGeos::sharedPaths ( const QgsAbstractGeometry other,
QString *  errorMsg = nullptr 
) const

Find paths shared between the two given lineal geometries (this and other).

Returns a GeometryCollection having two elements:

  • first element is a MultiLineString containing shared paths having the same direction on both inputs
  • second element is a MultiLineString containing shared paths having the opposite direction on the two inputs

Returns nullptr on exception.

Since
QGIS 3.20

Definition at line 2894 of file qgsgeos.cpp.

◆ shortestLine() [1/2]

QgsGeometry QgsGeos::shortestLine ( const QgsAbstractGeometry other,
QString *  errorMsg = nullptr 
) const

Returns the shortest line joining this geometry to the other geometry.

See also
closestPoint()
Since
QGIS 3.20

Definition at line 3105 of file qgsgeos.cpp.

◆ shortestLine() [2/2]

QgsGeometry QgsGeos::shortestLine ( const QgsGeometry other,
QString *  errorMsg = nullptr 
) const

Returns the shortest line joining this geometry to the other geometry.

See also
closestPoint()

Definition at line 3095 of file qgsgeos.cpp.

◆ simplify()

QgsAbstractGeometry * QgsGeos::simplify ( double  tolerance,
QString *  errorMsg = nullptr 
) const
overridevirtual

Implements QgsGeometryEngine.

Definition at line 2111 of file qgsgeos.cpp.

◆ simplifyCoverageVW()

std::unique_ptr< QgsAbstractGeometry > QgsGeos::simplifyCoverageVW ( double  tolerance,
bool  preserveBoundary,
QString *  errorMsg = nullptr 
) const

Operates on a coverage (represented as a list of polygonal geometry with exactly matching edge geometry) to apply a Visvalingam–Whyatt simplification to the edges, reducing complexity in proportion with the provided tolerance, while retaining a valid coverage (no edges will cross or touch after the simplification).

Geometries never disappear, but they may be simplified down to just a triangle. Also, some invalid geoms (such as Polygons which have too few non-repeated points) will be returned unchanged.

If the input dataset is not a valid coverage due to overlaps, it will still be simplified, but invalid topology such as crossing edges will still be invalid.

Parameters
toleranceA tolerance parameter in linear units.
preserveBoundarySet to true to preserve the outside edges of the coverage without simplification, or false to allow them to be simplified.
errorMsg

This method requires a QGIS build based on GEOS 3.12 or later.

Exceptions
QgsNotSupportedExceptionon QGIS builds based on GEOS 3.11 or earlier.
See also
validateCoverage()
Since
QGIS 3.36

Definition at line 2296 of file qgsgeos.cpp.

◆ singleSidedBuffer()

std::unique_ptr< QgsAbstractGeometry > QgsGeos::singleSidedBuffer ( double  distance,
int  segments,
Qgis::BufferSide  side,
Qgis::JoinStyle  joinStyle,
double  miterLimit,
QString *  errorMsg = nullptr 
) const

Returns a single sided buffer for a geometry.

The buffer is only applied to one side of the geometry.

Parameters
distancebuffer distance
segmentsfor round joins, number of segments to approximate quarter-circle
sideside of geometry to buffer (0 = left, 1 = right)
joinStylejoin style for corners ( Round (1) / Miter (2) / Bevel (3) )
miterLimitlimit on the miter ratio used for very sharp corners
errorMsgerror messages emitted, if any
Returns
buffered geometry, or an nullptr if buffer could not be calculated

Definition at line 2765 of file qgsgeos.cpp.

◆ splitGeometry()

QgsGeometryEngine::EngineOperationResult QgsGeos::splitGeometry ( const QgsLineString splitLine,
QVector< QgsGeometry > &  newGeometries,
bool  topological,
QgsPointSequence topologyTestPoints,
QString *  errorMsg = nullptr,
bool  skipIntersectionCheck = false 
) const
overridevirtual

Splits this geometry according to a given line.

Parameters
splitLinethe line that splits the geometry
[out]newGeometrieslist of new geometries that have been created with the split
topologicaltrue if topological editing is enabled
[out]topologyTestPointspoints that need to be tested for topological completeness in the dataset
[out]errorMsgerror messages emitted, if any
skipIntersectionCheckset to true to skip the potentially expensive initial intersection check. Only set this flag if an intersection test has already been performed by the caller!
Returns
0 in case of success, 1 if geometry has not been split, error else

Reimplemented from QgsGeometryEngine.

Definition at line 1040 of file qgsgeos.cpp.

◆ subdivide()

std::unique_ptr< QgsAbstractGeometry > QgsGeos::subdivide ( int  maxNodes,
QString *  errorMsg = nullptr,
const QgsGeometryParameters parameters = QgsGeometryParameters() 
) const

Subdivides the geometry.

The returned geometry will be a collection containing subdivided parts from the original geometry, where no part has more then the specified maximum number of nodes (maxNodes).

This is useful for dividing a complex geometry into less complex parts, which are better able to be spatially indexed and faster to perform further operations such as intersects on. The returned geometry parts may not be valid and may contain self-intersections.

The minimum allowed value for maxNodes is 8.

Curved geometries are not supported.

Parameters
maxNodesMaximum nodes used
errorMsgError message returned by GEOS
parameterscan be used to specify parameters which control the subdivision results (since QGIS 3.28)

Definition at line 448 of file qgsgeos.cpp.

◆ symDifference()

QgsAbstractGeometry * QgsGeos::symDifference ( const QgsAbstractGeometry geom,
QString *  errorMsg = nullptr,
const QgsGeometryParameters parameters = QgsGeometryParameters() 
) const
overridevirtual

Calculate the symmetric difference of this and geom.

Parameters
geomgeometry to perform the operation
errorMsgError message returned by GEOS
parameterscan be used to specify parameters which control the difference results (since QGIS 3.28)

Implements QgsGeometryEngine.

Definition at line 539 of file qgsgeos.cpp.

◆ touches()

bool QgsGeos::touches ( const QgsAbstractGeometry geom,
QString *  errorMsg = nullptr 
) const
overridevirtual

Checks if geom touches this.

Implements QgsGeometryEngine.

Definition at line 882 of file qgsgeos.cpp.

◆ unionCoverage()

std::unique_ptr< QgsAbstractGeometry > QgsGeos::unionCoverage ( QString *  errorMsg = nullptr) const

Optimized union algorithm for polygonal inputs that are correctly noded and do not overlap.

It may generate an error (returns nullptr) for inputs that do not satisfy this constraint, however this is not guaranteed.

The input geometry is the polygonal coverage to union, stored in a geometry collection. All members must be POLYGON or MULTIPOLYGON.

See also
validateCoverage()
Since
QGIS 3.36

Definition at line 2321 of file qgsgeos.cpp.

◆ validateCoverage()

Qgis::CoverageValidityResult QgsGeos::validateCoverage ( double  gapWidth,
std::unique_ptr< QgsAbstractGeometry > *  invalidEdges,
QString *  errorMsg = nullptr 
) const

Analyze a coverage (represented as a collection of polygonal geometry with exactly matching edge geometry) to find places where the assumption of exactly matching edges is not met.

The input geometry is the polygonal coverage to access, stored in a geometry collection. All members must be POLYGON or MULTIPOLYGON.

Parameters
gapWidthThe maximum width of gaps to detect.
invalidEdgesWhen there are invalidities in the coverage, this pointer will be set with a geometry collection of the same length as the input, with a MULTILINESTRING of the error edges for each invalid polygon, or an EMPTY where the polygon is a valid participant in the coverage. Pass nullptr if you do not want the invalid edges returned.
errorMsg

This method requires a QGIS build based on GEOS 3.12 or later.

Exceptions
QgsNotSupportedExceptionon QGIS builds based on GEOS 3.11 or earlier.
See also
simplifyCoverageVW()
Since
QGIS 3.36

Definition at line 2251 of file qgsgeos.cpp.

◆ voronoiDiagram()

QgsGeometry QgsGeos::voronoiDiagram ( const QgsAbstractGeometry extent = nullptr,
double  tolerance = 0.0,
bool  edgesOnly = false,
QString *  errorMsg = nullptr 
) const

Creates a Voronoi diagram for the nodes contained within the geometry.

Returns the Voronoi polygons for the nodes contained within the geometry. If extent is specified then it will be used as a clipping envelope for the diagram. If no extent is set then the clipping envelope will be automatically calculated. In either case the diagram will be clipped to the larger of the provided envelope OR the envelope surrounding all input nodes. The tolerance parameter specifies an optional snapping tolerance which can be used to improve the robustness of the diagram calculation. If edgesOnly is true than line string boundary geometries will be returned instead of polygons. An empty geometry will be returned if the diagram could not be calculated.

Definition at line 3253 of file qgsgeos.cpp.

◆ within()

bool QgsGeos::within ( const QgsAbstractGeometry geom,
QString *  errorMsg = nullptr 
) const
overridevirtual

Checks if geom is within this.

Implements QgsGeometryEngine.

Definition at line 892 of file qgsgeos.cpp.


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