|
QGIS API Documentation 4.1.0-Master (009143bf4b4)
|
Does vector analysis using the GEOS library and handles import, export, and exception handling. More...
#include <qgsgeos.h>

Public Member Functions | |
| QgsGeos (const QgsAbstractGeometry *geometry, double precision=0, Qgis::GeosCreationFlags flags=Qgis::GeosCreationFlag::SkipEmptyInteriorRings) | |
| GEOS geometry engine constructor. | |
| double | area (QString *errorMsg=nullptr) const override |
| QgsAbstractGeometry * | buffer (double distance, int segments, Qgis::EndCapStyle endCapStyle, Qgis::JoinStyle joinStyle, double miterLimit, QString *errorMsg=nullptr, QgsFeedback *feedback=nullptr) const override |
| Buffers a geometry. | |
| QgsAbstractGeometry * | buffer (double distance, int segments, QString *errorMsg=nullptr, QgsFeedback *feedback=nullptr) const override |
| Buffers the geometry. | |
| QgsPoint * | centroid (QString *errorMsg=nullptr, QgsFeedback *feedback=nullptr) const override |
| Calculates the centroid of this. | |
| std::unique_ptr< QgsAbstractGeometry > | clip (const QgsRectangle &rectangle, QString *errorMsg=nullptr, QgsFeedback *feedback=nullptr) const |
| Performs a fast, non-robust intersection between the geometry and a rectangle. | |
| std::unique_ptr< QgsAbstractGeometry > | closestPoint (const QgsGeometry &other, QString *errorMsg=nullptr, QgsFeedback *feedback=nullptr) const |
| Returns the closest point on the geometry to the other geometry. | |
| QgsAbstractGeometry * | combine (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr, const QgsGeometryParameters ¶meters=QgsGeometryParameters(), QgsFeedback *feedback=nullptr) const override |
| Calculate the combination of this and geom. | |
| QgsAbstractGeometry * | combine (const QVector< QgsAbstractGeometry * > &geomList, QString *errorMsg, const QgsGeometryParameters ¶meters=QgsGeometryParameters(), QgsFeedback *feedback=nullptr) const override |
| Calculate the combination of this and geometries. | |
| QgsAbstractGeometry * | combine (const QVector< QgsGeometry > &, QString *errorMsg=nullptr, const QgsGeometryParameters ¶meters=QgsGeometryParameters(), QgsFeedback *feedback=nullptr) const override |
| Calculate the combination of this and geometries. | |
| std::unique_ptr< QgsAbstractGeometry > | concaveHull (double targetPercent, bool allowHoles=false, QString *errorMsg=nullptr, QgsFeedback *feedback=nullptr) const |
| Returns a possibly concave geometry that encloses the input geometry. | |
| std::unique_ptr< QgsAbstractGeometry > | concaveHullOfPolygons (double lengthRatio, bool allowHoles=false, bool isTight=false, QString *errorMsg=nullptr, QgsFeedback *feedback=nullptr) const |
| Constructs a concave hull of a set of polygons, respecting the polygons as constraints. | |
| std::unique_ptr< QgsAbstractGeometry > | constrainedDelaunayTriangulation (QString *errorMsg=nullptr, QgsFeedback *feedback=nullptr) const |
| Returns a constrained Delaunay triangulation for the vertices of the geometry. | |
| bool | contains (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr, QgsFeedback *feedback=nullptr) const override |
| Checks if geom contains this. | |
| bool | contains (double x, double y, QString *errorMsg=nullptr, QgsFeedback *feedback=nullptr) const |
Returns true if the geometry contains the point at (x, y). | |
| QgsAbstractGeometry * | convexHull (QString *errorMsg=nullptr, QgsFeedback *feedback=nullptr) const override |
| Calculate the convex hull of this geometry. | |
| bool | crosses (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr, QgsFeedback *feedback=nullptr) const override |
| Checks if geom crosses this. | |
| std::unique_ptr< QgsAbstractGeometry > | delaunayTriangulation (double tolerance=0.0, bool edgesOnly=false, QString *errorMsg=nullptr, QgsFeedback *feedback=nullptr) const |
| Returns the Delaunay triangulation for the vertices of the geometry. | |
| QgsAbstractGeometry * | difference (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr, const QgsGeometryParameters ¶meters=QgsGeometryParameters(), QgsFeedback *feedback=nullptr) const override |
| Calculate the difference of this and geom. | |
| bool | disjoint (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr, QgsFeedback *feedback=nullptr) const override |
| Checks if geom is disjoint from this. | |
| double | distance (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr, QgsFeedback *feedback=nullptr) const override |
| Calculates the distance between this and geom. | |
| double | distance (double x, double y, QString *errorMsg=nullptr, QgsFeedback *feedback=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, QgsFeedback *feedback=nullptr) const override |
| Checks if geom is within maxdistance distance from this geometry. | |
| QgsAbstractGeometry * | envelope (QString *errorMsg=nullptr) const override |
| double | frechetDistance (const QgsAbstractGeometry *geometry, QString *errorMsg=nullptr, QgsFeedback *feedback=nullptr) const |
| Returns the Fréchet distance between this geometry and another geometry, restricted to discrete points for both geometries. | |
| double | frechetDistanceDensify (const QgsAbstractGeometry *geometry, double densifyFraction, QString *errorMsg=nullptr, QgsFeedback *feedback=nullptr) const |
| Returns the Fréchet distance between this geometry and another geometry, 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 *geometry, QString *errorMsg=nullptr, QgsFeedback *feedback=nullptr) const |
| Returns the Hausdorff distance between this geometry and another geometry. | |
| double | hausdorffDistanceDensify (const QgsAbstractGeometry *geometry, double densifyFraction, QString *errorMsg=nullptr, QgsFeedback *feedback=nullptr) const |
| Returns the Hausdorff distance between this geometry and another geometry. | |
| QgsAbstractGeometry * | interpolate (double distance, QString *errorMsg=nullptr, QgsFeedback *feedback=nullptr) const override |
| Interpolates a point by distance along the geometry. | |
| QgsAbstractGeometry * | intersection (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr, const QgsGeometryParameters ¶meters=QgsGeometryParameters(), QgsFeedback *feedback=nullptr) const override |
| Calculate the intersection of this and geom. | |
| bool | intersects (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr, QgsFeedback *feedback=nullptr) const override |
| Checks if geom intersects this. | |
| bool | isEmpty (QString *errorMsg=nullptr) const override |
| bool | isEqual (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr, QgsFeedback *feedback=nullptr) const override |
| Check if geometries are topologically equivalent. | |
| bool | isFuzzyEqual (const QgsAbstractGeometry *geom, double epsilon, QString *errorMsg=nullptr, QgsFeedback *feedback=nullptr) const override |
| Checks if this is equal to geom ie. | |
| 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, QgsFeedback *feedback=nullptr) const override |
Returns true if the geometry is valid. | |
| std::unique_ptr< QgsAbstractGeometry > | largestEmptyCircle (double tolerance, const QgsAbstractGeometry *boundary=nullptr, QString *errorMsg=nullptr, QgsFeedback *feedback=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, QgsFeedback *feedback=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, QgsFeedback *feedback=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< QgsAbstractGeometry > | makeValid (Qgis::MakeValidMethod method=Qgis::MakeValidMethod::Linework, bool keepCollapsed=false, QString *errorMsg=nullptr, QgsFeedback *feedback=nullptr) const |
| Repairs the geometry using GEOS make valid routine. | |
| std::unique_ptr< QgsAbstractGeometry > | maximumInscribedCircle (double tolerance, QString *errorMsg=nullptr, QgsFeedback *feedback=nullptr) const |
| Returns the maximum inscribed circle. | |
| std::unique_ptr< QgsAbstractGeometry > | mergeLines (QString *errorMsg=nullptr, const QgsGeometryParameters ¶meters=QgsGeometryParameters(), QgsFeedback *feedback=nullptr) const |
| Merges any connected lines in a LineString/MultiLineString geometry and converts them to single line strings. | |
| double | minimumClearance (QString *errorMsg=nullptr, QgsFeedback *feedback=nullptr) const |
| Computes the minimum clearance of a geometry. | |
| std::unique_ptr< QgsAbstractGeometry > | minimumClearanceLine (QString *errorMsg=nullptr, QgsFeedback *feedback=nullptr) const |
| Returns a LineString whose endpoints define the minimum clearance of a geometry. | |
| std::unique_ptr< QgsAbstractGeometry > | minimumWidth (QString *errorMsg=nullptr, QgsFeedback *feedback=nullptr) const |
| Returns a linestring geometry which represents the minimum diameter of the geometry. | |
| std::unique_ptr< QgsAbstractGeometry > | node (QString *errorMsg=nullptr, QgsFeedback *feedback=nullptr) const |
| Returns a (Multi)LineString representing the fully noded version of a collection of linestrings. | |
| QgsAbstractGeometry * | offsetCurve (double distance, int segments, Qgis::JoinStyle joinStyle, double miterLimit, QString *errorMsg=nullptr, QgsFeedback *feedback=nullptr) const override |
| Offsets a curve. | |
| bool | overlaps (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr, QgsFeedback *feedback=nullptr) const override |
| Checks if geom overlaps this. | |
| QgsPoint * | pointOnSurface (QString *errorMsg=nullptr, QgsFeedback *feedback=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, QgsFeedback *feedback=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, QgsFeedback *feedback=nullptr) const override |
| Tests whether two geometries are related by a specified Dimensional Extended 9 Intersection Model (DE-9IM) pattern. | |
| std::unique_ptr< QgsAbstractGeometry > | reshapeGeometry (const QgsLineString &reshapeWithLine, EngineOperationResult *errorCode, QString *errorMsg=nullptr) const |
| Reshapes the geometry using a line. | |
| std::unique_ptr< QgsAbstractGeometry > | sharedPaths (const QgsAbstractGeometry *other, QString *errorMsg=nullptr, QgsFeedback *feedback=nullptr) const |
| Find paths shared between the two given lineal geometries (this and other). | |
| std::unique_ptr< QgsAbstractGeometry > | shortestLine (const QgsAbstractGeometry *other, QString *errorMsg=nullptr, QgsFeedback *feedback=nullptr) const |
| Returns the shortest line joining this geometry to the other geometry. | |
| std::unique_ptr< QgsAbstractGeometry > | shortestLine (const QgsGeometry &other, QString *errorMsg=nullptr, QgsFeedback *feedback=nullptr) const |
| Returns the shortest line joining this geometry to the other geometry. | |
| QgsAbstractGeometry * | simplify (double tolerance, QString *errorMsg=nullptr, QgsFeedback *feedback=nullptr) const override |
| Simplifies the geometery. | |
| std::unique_ptr< QgsAbstractGeometry > | simplifyCoverageVW (double tolerance, bool preserveBoundary, QString *errorMsg=nullptr, QgsFeedback *feedback=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< QgsAbstractGeometry > | singleSidedBuffer (double distance, int segments, Qgis::BufferSide side, Qgis::JoinStyle joinStyle, double miterLimit, QString *errorMsg=nullptr, QgsFeedback *feedback=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< QgsAbstractGeometry > | subdivide (int maxNodes, QString *errorMsg=nullptr, const QgsGeometryParameters ¶meters=QgsGeometryParameters(), QgsFeedback *feedback=nullptr) const |
| Subdivides the geometry. | |
| QgsAbstractGeometry * | symDifference (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr, const QgsGeometryParameters ¶meters=QgsGeometryParameters(), QgsFeedback *feedback=nullptr) const override |
| Calculate the symmetric difference of this and geom. | |
| bool | touches (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr, QgsFeedback *feedback=nullptr) const override |
| Checks if geom touches this. | |
| std::unique_ptr< QgsAbstractGeometry > | unionCoverage (QString *errorMsg=nullptr, QgsFeedback *feedback=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, QgsFeedback *feedback=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. | |
| std::unique_ptr< QgsAbstractGeometry > | voronoiDiagram (const QgsAbstractGeometry *extent=nullptr, double tolerance=0.0, bool edgesOnly=false, QString *errorMsg=nullptr, QgsFeedback *feedback=nullptr) const |
| Creates a Voronoi diagram for the nodes contained within the geometry. | |
| bool | within (const QgsAbstractGeometry *geom, QString *errorMsg=nullptr, QgsFeedback *feedback=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 geos::unique_ptr | buffer (const GEOSGeometry *geometry, double distance, int segments, Qgis::EndCapStyle endCapStyle, Qgis::JoinStyle joinStyle, double miterLimit, QString *errorMsg=nullptr, QgsFeedback *feedback=nullptr) |
| Directly calculates the buffer for a GEOS geometry object and returns a GEOS geometry result. | |
| static QgsPoint | coordSeqPoint (const GEOSCoordSequence *cs, int i, bool hasZ, bool hasM) |
| static std::unique_ptr< QgsAbstractGeometry > | fromGeos (const GEOSGeometry *geos) |
| Create a geometry from a GEOSGeometry. | |
| static std::unique_ptr< QgsPolygon > | fromGeosPolygon (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 geos::unique_ptr | offsetCurve (const GEOSGeometry *geometry, double distance, int segments, Qgis::JoinStyle joinStyle, double miterLimit, QString *errorMsg=nullptr, QgsFeedback *feedback=nullptr) |
| Directly calculates the offset curve for a GEOS geometry object and returns a GEOS geometry result. | |
| static QgsGeometry | polygonize (const QVector< const QgsAbstractGeometry * > &geometries, QString *errorMsg=nullptr, QgsFeedback *feedback=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 QgsAbstractGeometry * | mGeometry = nullptr |
| bool | mLogErrors = true |
Does vector analysis using the GEOS library and handles import, export, and exception handling.
| QgsGeos::QgsGeos | ( | const QgsAbstractGeometry * | geometry, |
| double | precision = 0, | ||
| Qgis::GeosCreationFlags | flags = Qgis::GeosCreationFlag::SkipEmptyInteriorRings ) |
GEOS geometry engine constructor.
| geometry | The geometry |
| precision | The precision of the grid to which to snap the geometry vertices. If 0, no snapping is performed. |
| flags | GEOS creation flags (since QGIS 3.40) |
Definition at line 181 of file qgsgeos.cpp.
|
static |
Adds a new island polygon to a multipolygon feature.
| geometry | geometry to add part to |
| newPart | part to add. Ownership is NOT transferred. |
Definition at line 270 of file qgsgeos.cpp.
|
overridevirtual |
Implements QgsGeometryEngine.
Definition at line 1031 of file qgsgeos.cpp.
|
static |
Returns a geos geometry - caller takes ownership of the object (should be deleted with GEOSGeom_destroy_r).
| geometry | geometry to convert to GEOS representation |
| precision | The precision of the grid to which to snap the geometry vertices. If 0, no snapping is performed. |
| flags | GEOS creation flags (since QGIS 3.40) |
Definition at line 1823 of file qgsgeos.cpp.
|
static |
Returns a geos geometry - caller takes ownership of the object (should be deleted with GEOSGeom_destroy_r).
| geometry | geometry to convert to GEOS representation |
| precision | The precision of the grid to which to snap the geometry vertices. If 0, no snapping is performed. |
| flags | GEOS creation flags (since QGIS 3.40) |
Definition at line 260 of file qgsgeos.cpp.
|
static |
Directly calculates the buffer for a GEOS geometry object and returns a GEOS geometry result.
The optional feedback argument allows for early cancellation (since QGIS 4.2).
Definition at line 2130 of file qgsgeos.cpp.
|
overridevirtual |
Buffers a geometry.
The optional feedback argument allows for early cancellation (since QGIS 4.2).
Implements QgsGeometryEngine.
Definition at line 2124 of file qgsgeos.cpp.
|
overridevirtual |
Buffers the geometry.
| distance | |
| segments | |
| errorMsg | Error message returned by GEOS |
| feedback | optional feedback object for early cancellation (since QGIS 4.2). |
Implements QgsGeometryEngine.
Definition at line 2106 of file qgsgeos.cpp.
|
overridevirtual |
Calculates the centroid of this.
May return nullptr.
The optional feedback argument allows for early cancellation (since QGIS 4.2).
Implements QgsGeometryEngine.
Definition at line 2181 of file qgsgeos.cpp.
| std::unique_ptr< QgsAbstractGeometry > QgsGeos::clip | ( | const QgsRectangle & | rectangle, |
| QString * | errorMsg = nullptr, | ||
| QgsFeedback * | feedback = nullptr ) const |
Performs a fast, non-robust intersection between the geometry and a rectangle.
The returned geometry may be invalid.
| rectangle | clipping rectangle |
| errorMsg | will be set to descriptive error string if the operation fails |
| feedback | optional feedback object for early cancellation (since QGIS 4.2). |
Definition at line 330 of file qgsgeos.cpp.
| std::unique_ptr< QgsAbstractGeometry > QgsGeos::closestPoint | ( | const QgsGeometry & | other, |
| QString * | errorMsg = nullptr, | ||
| QgsFeedback * | feedback = nullptr ) const |
Returns the closest point on the geometry to the other geometry.
| other | geometry to compare against |
| errorMsg | will be set to descriptive error string if the operation fails |
| feedback | optional feedback object for early cancellation (since QGIS 4.2). |
Definition at line 3179 of file qgsgeos.cpp.
|
overridevirtual |
Calculate the combination of this and geom.
| geom | geometry to perform the operation |
| errorMsg | Error message returned by GEOS |
| parameters | can be used to specify parameters which control the union results (since QGIS 3.28) |
| feedback | optional feedback object for early cancellation (since QGIS 4.2). |
Implements QgsGeometryEngine.
Definition at line 473 of file qgsgeos.cpp.
|
overridevirtual |
Calculate the combination of this and geometries.
| geomList | list of geometries to perform the operation |
| errorMsg | Error message returned by GEOS |
| parameters | can be used to specify parameters which control the combination results (since QGIS 3.28) |
| feedback | optional feedback object for early cancellation (since QGIS 4.2). |
Implements QgsGeometryEngine.
Definition at line 478 of file qgsgeos.cpp.
|
overridevirtual |
Calculate the combination of this and geometries.
| geometries | list of geometries to perform the operation |
| errorMsg | Error message returned by GEOS |
| parameters | can be used to specify parameters which control the combination results (since QGIS 3.28) |
| feedback | optional feedback object for early cancellation (since QGIS 4.2). |
Implements QgsGeometryEngine.
Definition at line 511 of file qgsgeos.cpp.
| std::unique_ptr< QgsAbstractGeometry > QgsGeos::concaveHull | ( | double | targetPercent, |
| bool | allowHoles = false, | ||
| QString * | errorMsg = nullptr, | ||
| QgsFeedback * | feedback = 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.
| targetPercent | |
| allowHoles | |
| errorMsg | will be set to descriptive error string if the operation fails |
| feedback | optional feedback object for early cancellation (since QGIS 4.2). |
| QgsNotSupportedException | on QGIS builds based on GEOS 3.10 or earlier. |
Definition at line 2271 of file qgsgeos.cpp.
| std::unique_ptr< QgsAbstractGeometry > QgsGeos::concaveHullOfPolygons | ( | double | lengthRatio, |
| bool | allowHoles = false, | ||
| bool | isTight = false, | ||
| QString * | errorMsg = nullptr, | ||
| QgsFeedback * | feedback = nullptr ) const |
Constructs a concave hull of a set of polygons, respecting the polygons as constraints.
A concave hull is a (possibly) non-convex polygon containing all the input polygons.
The computed hull "fills the gap" between the polygons, and does not intersect their interior.
A set of polygons has a sequence of hulls of increasing concaveness, determined by a numeric target parameter.
The concave hull is constructed by removing the longest outer edges of the Delaunay Triangulation of the space between the polygons, until the target criterion parameter is reached.
The "Maximum Edge Length" parameter limits the length of the longest edge between polygons to be no larger than this value. This can be expressed as a ratio between the lengths of the longest and shortest edges.
The input geometry must be a valid MultiPolygon (i.e. they must be non-overlapping).
| lengthRatio | specifies the Maximum Edge Length as a fraction of the difference between the longest and shortest edge lengths between the polygons. This normalizes the Maximum Edge Length to be scale-free. A value of 1 produces the convex hull; a value of 0 produces the original polygons. |
| allowHoles | set to true to allow the concave hull to contain holes |
| isTight | set to true if the concave hull should follow the outer boundaries of the input polygons |
| errorMsg | will be set to descriptive error string if the operation fails |
| feedback | optional feedback object for early cancellation. |
This method requires a QGIS build based on GEOS 3.11 or later.
| QgsNotSupportedException | on QGIS builds based on GEOS 3.10 or earlier. |
Definition at line 2295 of file qgsgeos.cpp.
| std::unique_ptr< QgsAbstractGeometry > QgsGeos::constrainedDelaunayTriangulation | ( | QString * | errorMsg = nullptr, |
| QgsFeedback * | feedback = 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.
| errorMsg | will be set to descriptive error string if the operation fails |
| feedback | optional feedback object for early cancellation (since QGIS 4.2). |
| QgsNotSupportedException | on QGIS builds based on GEOS 3.10 or earlier. |
Definition at line 3444 of file qgsgeos.cpp.
|
overridevirtual |
Checks if geom contains this.
The optional feedback argument allows for early cancellation (since QGIS 4.2).
Implements QgsGeometryEngine.
Definition at line 922 of file qgsgeos.cpp.
| bool QgsGeos::contains | ( | double | x, |
| double | y, | ||
| QString * | errorMsg = nullptr, | ||
| QgsFeedback * | feedback = 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.
| x | x-coordinate of point to test |
| y | y-coordinate of point to test |
| errorMsg | will be set to descriptive error string if the operation fails |
| feedback | optional feedback object for early cancellation (since QGIS 4.2). |
true if the geometry contains the pointDefinition at line 728 of file qgsgeos.cpp.
|
overridevirtual |
Calculate the convex hull of this geometry.
The optional feedback argument allows for early cancellation (since QGIS 4.2).
Implements QgsGeometryEngine.
Definition at line 2254 of file qgsgeos.cpp.
|
static |
Definition at line 1786 of file qgsgeos.cpp.
|
overridevirtual |
Checks if geom crosses this.
The optional feedback argument allows for early cancellation (since QGIS 4.2).
Implements QgsGeometryEngine.
Definition at line 907 of file qgsgeos.cpp.
| std::unique_ptr< QgsAbstractGeometry > QgsGeos::delaunayTriangulation | ( | double | tolerance = 0.0, |
| bool | edgesOnly = false, | ||
| QString * | errorMsg = nullptr, | ||
| QgsFeedback * | feedback = 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.
| tolerance | |
| edgesOnly | |
| errorMsg | will be set to descriptive error string if the operation fails |
| feedback | optional feedback object for early cancellation (since QGIS 4.2). |
Definition at line 3420 of file qgsgeos.cpp.
|
overridevirtual |
Calculate the difference of this and geom.
| geom | geometry to perform the operation |
| errorMsg | Error message returned by GEOS |
| parameters | can be used to specify parameters which control the difference results (since QGIS 3.28) |
| feedback | optional feedback object for early cancellation (since QGIS 4.2). |
Implements QgsGeometryEngine.
Definition at line 325 of file qgsgeos.cpp.
|
overridevirtual |
Checks if geom is disjoint from this.
The optional feedback argument allows for early cancellation (since QGIS 4.2).
Implements QgsGeometryEngine.
Definition at line 956 of file qgsgeos.cpp.
|
overridevirtual |
Calculates the distance between this and geom.
The optional feedback argument allows for early cancellation (since QGIS 4.2).
Implements QgsGeometryEngine.
Definition at line 587 of file qgsgeos.cpp.
| double QgsGeos::distance | ( | double | x, |
| double | y, | ||
| QString * | errorMsg = nullptr, | ||
| QgsFeedback * | feedback = 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.
| x | x-coordinate of point to test |
| y | y-coordinate of point to test |
| errorMsg | will be set to descriptive error string if the operation fails |
| feedback | optional feedback object for early cancellation (since QGIS 4.2). |
Definition at line 634 of file qgsgeos.cpp.
|
overridevirtual |
Checks if geom is within maxdistance distance from this geometry.
The optional feedback argument allows for early cancellation (since QGIS 4.2).
Implements QgsGeometryEngine.
Definition at line 664 of file qgsgeos.cpp.
|
overridevirtual |
Implements QgsGeometryEngine.
Definition at line 2209 of file qgsgeos.cpp.
| double QgsGeos::frechetDistance | ( | const QgsAbstractGeometry * | geometry, |
| QString * | errorMsg = nullptr, | ||
| QgsFeedback * | feedback = nullptr ) const |
Returns the Fréchet distance between this geometry and another geometry, 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.
| geometry | geometry to compare to |
| errorMsg | will be set to descriptive error string if the operation fails |
| feedback | optional feedback object for early cancellation (since QGIS 4.2). |
| QgsNotSupportedException | on QGIS builds based on GEOS 3.6 or earlier. |
Definition at line 820 of file qgsgeos.cpp.
| double QgsGeos::frechetDistanceDensify | ( | const QgsAbstractGeometry * | geometry, |
| double | densifyFraction, | ||
| QString * | errorMsg = nullptr, | ||
| QgsFeedback * | feedback = nullptr ) const |
Returns the Fréchet distance between this geometry and another geometry, 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.
| geometry | geometry to compare to |
| densifyFraction | fraction by which to densify each segment |
| errorMsg | will be set to descriptive error string if the operation fails |
| feedback | optional feedback object for early cancellation (since QGIS 4.2). |
| QgsNotSupportedException | on QGIS builds based on GEOS 3.6 or earlier. |
Definition at line 844 of file qgsgeos.cpp.
|
static |
Create a geometry from a GEOSGeometry.
| geos | GEOSGeometry. Ownership is NOT transferred. |
Definition at line 1585 of file qgsgeos.cpp.
|
static |
Definition at line 1694 of file qgsgeos.cpp.
|
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 285 of file qgsgeos.cpp.
|
static |
Creates a new QgsGeometry object, feeding in a geometry in GEOS format.
Definition at line 196 of file qgsgeos.cpp.
|
static |
Creates a new QgsGeometry object, feeding in a geometry in GEOS format.
This class will take ownership of the buffer.
Definition at line 189 of file qgsgeos.cpp.
| double QgsGeos::hausdorffDistance | ( | const QgsAbstractGeometry * | geometry, |
| QString * | errorMsg = nullptr, | ||
| QgsFeedback * | feedback = nullptr ) const |
Returns the Hausdorff distance between this geometry and another geometry.
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:
If the default approximate provided by this method is insufficient, use hausdorffDistanceDensify() instead.
| geometry | geometry to compare to |
| errorMsg | will be set to descriptive error string if the operation fails |
| feedback | optional feedback object for early cancellation (since QGIS 4.2) |
Definition at line 772 of file qgsgeos.cpp.
| double QgsGeos::hausdorffDistanceDensify | ( | const QgsAbstractGeometry * | geometry, |
| double | densifyFraction, | ||
| QString * | errorMsg = nullptr, | ||
| QgsFeedback * | feedback = nullptr ) const |
Returns the Hausdorff distance between this geometry and another geometry.
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.
| geometry | geometry to compare to |
| densifyFraction | fraction by which to densify each segment |
| errorMsg | will be set to descriptive error string if the operation fails |
| feedback | optional feedback object for early cancellation (since QGIS 4.2). |
Definition at line 796 of file qgsgeos.cpp.
|
overridevirtual |
Interpolates a point by distance along the geometry.
| distance | |
| errorMsg | Error message returned by GEOS |
| feedback | optional feedback object for early cancellation (since QGIS 4.2). |
Implements QgsGeometryEngine.
Definition at line 2165 of file qgsgeos.cpp.
|
overridevirtual |
Calculate the intersection of this and geom.
| geom | geometry to perform the operation |
| errorMsg | Error message returned by GEOS |
| parameters | can be used to specify parameters which control the intersection results (since QGIS 3.28) |
| feedback | optional feedback object for early cancellation (since QGIS 4.2). |
Implements QgsGeometryEngine.
Definition at line 320 of file qgsgeos.cpp.
|
overridevirtual |
Checks if geom intersects this.
The optional feedback argument allows for early cancellation (since QGIS 4.2).
Implements QgsGeometryEngine.
Definition at line 868 of file qgsgeos.cpp.
|
overridevirtual |
Implements QgsGeometryEngine.
Definition at line 2517 of file qgsgeos.cpp.
|
overridevirtual |
Check if geometries are topologically equivalent.
| geom | other geom to compare with |
| errorMsg | will be set to descriptive error string if the operation fails |
| feedback | optional feedback object for early cancellation (since QGIS 4.2). |
true if topologically equivalent, else false Implements QgsGeometryEngine.
Definition at line 2474 of file qgsgeos.cpp.
|
overridevirtual |
Checks if this is equal to geom ie.
if each vertex of this is within the distance tolerance of the corresponding vertex in geom. If both are Null geometries, false is returned.
| geom | geometry to compare with |
| epsilon | maximum difference for coordinates between the objects. With a near zero epsilon, this function will behave as an exact comparison. |
| errorMsg | destination storage for any error message |
| feedback | optional feedback object for early cancellation (since QGIS 4.2). |
true if fuzzy equivalent, else false Implements QgsGeometryEngine.
Definition at line 2495 of file qgsgeos.cpp.
|
overridevirtual |
Determines whether the geometry is simple (according to OGC definition).
Implements QgsGeometryEngine.
Definition at line 2531 of file qgsgeos.cpp.
|
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.
The optional feedback argument allows for early cancellation (since QGIS 4.2).
Implements QgsGeometryEngine.
Definition at line 2410 of file qgsgeos.cpp.
| std::unique_ptr< QgsAbstractGeometry > QgsGeos::largestEmptyCircle | ( | double | tolerance, |
| const QgsAbstractGeometry * | boundary = nullptr, | ||
| QString * | errorMsg = nullptr, | ||
| QgsFeedback * | feedback = 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.
| tolerance | tolerance to determine when iteration should end |
| boundary | optional set of boundary obstacles |
| errorMsg | will be set to descriptive error string if the operation fails |
| feedback | optional feedback object for early cancellation (since QGIS 4.2). |
| QgsNotSupportedException | on QGIS builds based on GEOS 3.8 or earlier. |
Definition at line 2907 of file qgsgeos.cpp.
|
overridevirtual |
Implements QgsGeometryEngine.
Definition at line 1048 of file qgsgeos.cpp.
| double QgsGeos::lineLocatePoint | ( | const QgsPoint & | point, |
| QString * | errorMsg = nullptr, | ||
| QgsFeedback * | feedback = 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.
| point | point to seek proximity to |
| errorMsg | will be set to descriptive error string if the operation fails |
| feedback | optional feedback object for early cancellation (since QGIS 4.2). |
Definition at line 3283 of file qgsgeos.cpp.
| double QgsGeos::lineLocatePoint | ( | double | x, |
| double | y, | ||
| QString * | errorMsg = nullptr, | ||
| QgsFeedback * | feedback = 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.
| x | x-coordinate of point to locate |
| y | y-coordinate of point to locate |
| errorMsg | will be set to descriptive error string if the operation fails |
| feedback | optional feedback object for early cancellation (since QGIS 4.2). |
Definition at line 3315 of file qgsgeos.cpp.
| std::unique_ptr< QgsAbstractGeometry > QgsGeos::makeValid | ( | Qgis::MakeValidMethod | method = Qgis::MakeValidMethod::Linework, |
| bool | keepCollapsed = false, | ||
| QString * | errorMsg = nullptr, | ||
| QgsFeedback * | feedback = nullptr ) const |
Repairs the geometry using GEOS make valid routine.
The method and keepCollapsed arguments require builds based on GEOS 3.10 or later.
The optional feedback argument allows for early cancellation (since QGIS 4.2).
| QgsNotSupportedException | on QGIS builds based on GEOS 3.9 or earlier when the method is not Qgis::MakeValidMethod::Linework or the keepCollapsed option is set. |
Definition at line 202 of file qgsgeos.cpp.
| std::unique_ptr< QgsAbstractGeometry > QgsGeos::maximumInscribedCircle | ( | double | tolerance, |
| QString * | errorMsg = nullptr, | ||
| QgsFeedback * | feedback = 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.
| tolerance | tolerance to determine when iteration should end |
| errorMsg | will be set to descriptive error string if the operation fails |
| feedback | optional feedback object for early cancellation (since QGIS 4.2). |
| QgsNotSupportedException | on QGIS builds based on GEOS 3.8 or earlier. |
Definition at line 2890 of file qgsgeos.cpp.
| std::unique_ptr< QgsAbstractGeometry > QgsGeos::mergeLines | ( | QString * | errorMsg = nullptr, |
| const QgsGeometryParameters & | parameters = QgsGeometryParameters(), | ||
| QgsFeedback * | feedback = nullptr ) const |
Merges any connected lines in a LineString/MultiLineString geometry and converts them to single line strings.
| errorMsg | will be set to descriptive error string if the operation fails |
| feedback | optional feedback object for early cancellation (since QGIS 4.2). |
| parameters | can be used to specify parameters which control the mergeLines results (since QGIS 3.44) |
Definition at line 3151 of file qgsgeos.cpp.
| double QgsGeos::minimumClearance | ( | QString * | errorMsg = nullptr, |
| QgsFeedback * | feedback = 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:
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.
| errorMsg | will be set to descriptive error string if the operation fails |
| feedback | optional feedback object for early cancellation (since QGIS 4.2). |
| QgsNotSupportedException | on QGIS builds based on GEOS 3.5 or earlier. |
Definition at line 2945 of file qgsgeos.cpp.
| std::unique_ptr< QgsAbstractGeometry > QgsGeos::minimumClearanceLine | ( | QString * | errorMsg = nullptr, |
| QgsFeedback * | feedback = 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.
| errorMsg | will be set to descriptive error string if the operation fails |
| feedback | optional feedback object for early cancellation (since QGIS 4.2). |
| QgsNotSupportedException | on QGIS builds based on GEOS 3.5 or earlier. |
Definition at line 2964 of file qgsgeos.cpp.
| std::unique_ptr< QgsAbstractGeometry > QgsGeos::minimumWidth | ( | QString * | errorMsg = nullptr, |
| QgsFeedback * | feedback = 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.
| errorMsg | will be set to descriptive error string if the operation fails |
| feedback | optional feedback object for early cancellation (since QGIS 4.2). |
| QgsNotSupportedException | on QGIS builds based on GEOS 3.5 or earlier. |
Definition at line 2928 of file qgsgeos.cpp.
| std::unique_ptr< QgsAbstractGeometry > QgsGeos::node | ( | QString * | errorMsg = nullptr, |
| QgsFeedback * | feedback = 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.
| errorMsg | will be set to descriptive error string if the operation fails |
| feedback | optional feedback object for early cancellation (since QGIS 4.2). |
Definition at line 2981 of file qgsgeos.cpp.
|
static |
Directly calculates the offset curve for a GEOS geometry object and returns a GEOS geometry result.
The optional feedback argument allows for early cancellation (since QGIS 4.2).
Definition at line 2832 of file qgsgeos.cpp.
|
overridevirtual |
Offsets a curve.
The optional feedback argument allows for early cancellation (since QGIS 4.2).
Implements QgsGeometryEngine.
Definition at line 2851 of file qgsgeos.cpp.
|
overridevirtual |
Checks if geom overlaps this.
The optional feedback argument allows for early cancellation (since QGIS 4.2).
Implements QgsGeometryEngine.
Definition at line 917 of file qgsgeos.cpp.
|
overridevirtual |
Calculate a point that is guaranteed to be on the surface of this.
May return nullptr.
The optional feedback argument allows for early cancellation (since QGIS 4.2).
Implements QgsGeometryEngine.
Definition at line 2224 of file qgsgeos.cpp.
|
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.
The optional feedback argument allows for early cancellation (since QGIS 4.2).
Definition at line 3345 of file qgsgeos.cpp.
|
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.
Implements QgsGeometryEngine.
Definition at line 292 of file qgsgeos.cpp.
|
overridevirtual |
Returns the Dimensional Extended 9 Intersection Model (DE-9IM) representation of the relationship between the geometries.
| geom | geometry to relate to |
| errorMsg | destination storage for any error message |
| feedback | optional feedback object for early cancellation (since QGIS 4.2). |
Implements QgsGeometryEngine.
Definition at line 961 of file qgsgeos.cpp.
|
overridevirtual |
Tests whether two geometries are related by a specified Dimensional Extended 9 Intersection Model (DE-9IM) pattern.
| geom | geometry to relate to |
| pattern | DE-9IM pattern for match |
| errorMsg | destination storage for any error message |
| feedback | optional feedback object for early cancellation (since QGIS 4.2). |
true if geometry relationship matches with pattern Implements QgsGeometryEngine.
Definition at line 998 of file qgsgeos.cpp.
| std::unique_ptr< QgsAbstractGeometry > QgsGeos::reshapeGeometry | ( | const QgsLineString & | reshapeWithLine, |
| EngineOperationResult * | errorCode, | ||
| QString * | errorMsg = nullptr ) const |
Reshapes the geometry using a line.
| reshapeWithLine | the line used to reshape lines or polygons |
| errorCode | if specified, provides result of operation (success or reason of failure) |
| errorMsg | will be set to descriptive error string if the operation fails |
Definition at line 3019 of file qgsgeos.cpp.
| std::unique_ptr< QgsAbstractGeometry > QgsGeos::sharedPaths | ( | const QgsAbstractGeometry * | other, |
| QString * | errorMsg = nullptr, | ||
| QgsFeedback * | feedback = nullptr ) const |
Find paths shared between the two given lineal geometries (this and other).
Returns a GeometryCollection having two elements:
| other | geometry to compare against |
| errorMsg | will be set to descriptive error string if the operation fails |
| feedback | optional feedback object for early cancellation (since QGIS 4.2). |
nullptr on exceptionDefinition at line 2998 of file qgsgeos.cpp.
| std::unique_ptr< QgsAbstractGeometry > QgsGeos::shortestLine | ( | const QgsAbstractGeometry * | other, |
| QString * | errorMsg = nullptr, | ||
| QgsFeedback * | feedback = nullptr ) const |
Returns the shortest line joining this geometry to the other geometry.
| other | geometry to compare against |
| errorMsg | will be set to descriptive error string if the operation fails |
| feedback | optional feedback object for early cancellation (since QGIS 4.2). |
Definition at line 3234 of file qgsgeos.cpp.
| std::unique_ptr< QgsAbstractGeometry > QgsGeos::shortestLine | ( | const QgsGeometry & | other, |
| QString * | errorMsg = nullptr, | ||
| QgsFeedback * | feedback = nullptr ) const |
Returns the shortest line joining this geometry to the other geometry.
| other | geometry to compare against |
| errorMsg | will be set to descriptive error string if the operation fails |
| feedback | optional feedback object for early cancellation (since QGIS 4.2). |
Definition at line 3224 of file qgsgeos.cpp.
|
overridevirtual |
Simplifies the geometery.
| tolerance | |
| errorMsg | Error message returned by GEOS |
| feedback | optional feedback object for early cancellation (since QGIS 4.2). |
Implements QgsGeometryEngine.
Definition at line 2149 of file qgsgeos.cpp.
| std::unique_ptr< QgsAbstractGeometry > QgsGeos::simplifyCoverageVW | ( | double | tolerance, |
| bool | preserveBoundary, | ||
| QString * | errorMsg = nullptr, | ||
| QgsFeedback * | feedback = 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.
| tolerance | A tolerance parameter in linear units. |
| preserveBoundary | Set to true to preserve the outside edges of the coverage without simplification, or false to allow them to be simplified. |
| errorMsg | will be set to descriptive error string if the operation fails |
| feedback | optional feedback object for early cancellation (since QGIS 4.2). |
This method requires a QGIS build based on GEOS 3.12 or later.
| QgsNotSupportedException | on QGIS builds based on GEOS 3.11 or earlier. |
Definition at line 2365 of file qgsgeos.cpp.
| std::unique_ptr< QgsAbstractGeometry > QgsGeos::singleSidedBuffer | ( | double | distance, |
| int | segments, | ||
| Qgis::BufferSide | side, | ||
| Qgis::JoinStyle | joinStyle, | ||
| double | miterLimit, | ||
| QString * | errorMsg = nullptr, | ||
| QgsFeedback * | feedback = nullptr ) const |
Returns a single sided buffer for a geometry.
The buffer is only applied to one side of the geometry.
| distance | buffer distance |
| segments | for round joins, number of segments to approximate quarter-circle |
| side | side of geometry to buffer (0 = left, 1 = right) |
| joinStyle | join style for corners ( Round (1) / Miter (2) / Bevel (3) ) |
| miterLimit | limit on the miter ratio used for very sharp corners |
| errorMsg | will be set to descriptive error string if the operation fails |
| feedback | optional feedback object for early cancellation (since QGIS 4.2). |
nullptr if buffer could not be calculated Definition at line 2860 of file qgsgeos.cpp.
|
overridevirtual |
Splits this geometry according to a given line.
| splitLine | the line that splits the geometry | |
| [out] | newGeometries | list of new geometries that have been created with the split |
| topological | true if topological editing is enabled | |
| [out] | topologyTestPoints | points that need to be tested for topological completeness in the dataset |
| [out] | errorMsg | error messages emitted, if any |
| skipIntersectionCheck | set 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! |
Reimplemented from QgsGeometryEngine.
Definition at line 1064 of file qgsgeos.cpp.
| std::unique_ptr< QgsAbstractGeometry > QgsGeos::subdivide | ( | int | maxNodes, |
| QString * | errorMsg = nullptr, | ||
| const QgsGeometryParameters & | parameters = QgsGeometryParameters(), | ||
| QgsFeedback * | feedback = nullptr ) 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.
| maxNodes | Maximum nodes used |
| errorMsg | will be set to descriptive error string if the operation fails |
| parameters | can be used to specify parameters which control the subdivision results (since QGIS 3.28) |
| feedback | optional feedback object for early cancellation (since QGIS 4.2). |
Definition at line 452 of file qgsgeos.cpp.
|
overridevirtual |
Calculate the symmetric difference of this and geom.
| geom | geometry to perform the operation |
| errorMsg | Error message returned by GEOS |
| parameters | can be used to specify parameters which control the difference results (since QGIS 3.28) |
| feedback | optional feedback object for early cancellation (since QGIS 4.2). |
Implements QgsGeometryEngine.
Definition at line 545 of file qgsgeos.cpp.
|
overridevirtual |
Checks if geom touches this.
The optional feedback argument allows for early cancellation (since QGIS 4.2).
Implements QgsGeometryEngine.
Definition at line 902 of file qgsgeos.cpp.
| std::unique_ptr< QgsAbstractGeometry > QgsGeos::unionCoverage | ( | QString * | errorMsg = nullptr, |
| QgsFeedback * | feedback = 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.
| errorMsg | will be set to descriptive error string if the operation fails |
| feedback | optional feedback object for early cancellation (since QGIS 4.2). |
Definition at line 2391 of file qgsgeos.cpp.
| Qgis::CoverageValidityResult QgsGeos::validateCoverage | ( | double | gapWidth, |
| std::unique_ptr< QgsAbstractGeometry > * | invalidEdges, | ||
| QString * | errorMsg = nullptr, | ||
| QgsFeedback * | feedback = 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.
| gapWidth | The maximum width of gaps to detect. |
| invalidEdges | When 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 | |
| feedback | optional feedback object for early cancellation (since QGIS 4.2). |
This method requires a QGIS build based on GEOS 3.12 or later.
| QgsNotSupportedException | on QGIS builds based on GEOS 3.11 or earlier. |
Definition at line 2319 of file qgsgeos.cpp.
| std::unique_ptr< QgsAbstractGeometry > QgsGeos::voronoiDiagram | ( | const QgsAbstractGeometry * | extent = nullptr, |
| double | tolerance = 0.0, | ||
| bool | edgesOnly = false, | ||
| QString * | errorMsg = nullptr, | ||
| QgsFeedback * | feedback = 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.
| extent | optional clipping envelope for the diagram |
| tolerance | |
| edgesOnly | |
| errorMsg | will be set to descriptive error string if the operation fails |
| feedback | optional feedback object for early cancellation (since QGIS 4.2). |
Definition at line 3386 of file qgsgeos.cpp.
|
overridevirtual |
Checks if geom is within this.
The optional feedback argument allows for early cancellation (since QGIS 4.2).
Implements QgsGeometryEngine.
Definition at line 912 of file qgsgeos.cpp.