QGIS API Documentation
2.99.0Master (23ddace)

A geometry is the spatial representation of a feature. More...
#include <qgsgeometry.h>
Classes  
class  Error 
Public Types  
enum  BufferSide { SideLeft = 0, SideRight } 
Side of line to buffer. More...  
enum  EndCapStyle { CapRound = 1, CapFlat, CapSquare } 
End cap styles for buffers. More...  
enum  JoinStyle { JoinStyleRound = 1, JoinStyleMitre, JoinStyleBevel } 
Join styles for buffers. More...  
enum  ValidationMethod { ValidatorQgisInternal, ValidatorGeos } 
Available methods for validating geometries. More...  
Public Member Functions  
QgsGeometry ()  
Constructor. More...  
QgsGeometry (const QgsGeometry &)  
Copy constructor will prompt a deep copy of the object. More...  
QgsGeometry (QgsAbstractGeometry *geom)  
Creates a geometry from an abstract geometry object. More...  
~QgsGeometry ()  
int  addPart (const QList< QgsPointXY > &points, QgsWkbTypes::GeometryType geomType=QgsWkbTypes::UnknownGeometry) 
Adds a new part to a the geometry. More...  
int  addPart (const QgsPointSequence &points, QgsWkbTypes::GeometryType geomType=QgsWkbTypes::UnknownGeometry) 
Adds a new part to a the geometry. More...  
int  addPart (QgsAbstractGeometry *part, QgsWkbTypes::GeometryType geomType=QgsWkbTypes::UnknownGeometry) 
Adds a new part to this geometry. More...  
int  addPart (GEOSGeometry *newPart) 
Adds a new island polygon to a multipolygon feature. More...  
int  addPart (const QgsGeometry &newPart) 
Adds a new island polygon to a multipolygon feature. More...  
int  addRing (const QList< QgsPointXY > &ring) 
Adds a new ring to this geometry. More...  
int  addRing (QgsCurve *ring) 
Adds a new ring to this geometry. More...  
void  adjacentVertices (int atVertex, int &beforeVertex, int &afterVertex) const 
Returns the indexes of the vertices before and after the given vertex index. More...  
double  angleAtVertex (int vertex) const 
Returns the bisector angle for this geometry at the specified vertex. More...  
double  area () const 
Returns the area of the geometry using GEOS. More...  
QList< QgsGeometry >  asGeometryCollection () const 
Return contents of the geometry as a list of geometries. More...  
QgsMultiPoint  asMultiPoint () const 
Return contents of the geometry as a multi point if wkbType is WKBMultiPoint, otherwise an empty list. More...  
QgsMultiPolygon  asMultiPolygon () const 
Return contents of the geometry as a multi polygon if wkbType is WKBMultiPolygon, otherwise an empty list. More...  
QgsMultiPolyline  asMultiPolyline () const 
Return contents of the geometry as a multi linestring if wkbType is WKBMultiLineString, otherwise an empty list. More...  
QgsPointXY  asPoint () const 
Return contents of the geometry as a point if wkbType is WKBPoint, otherwise returns [0,0]. More...  
QgsPolygon  asPolygon () const 
Return contents of the geometry as a polygon if wkbType is WKBPolygon, otherwise an empty list. More...  
QgsPolyline  asPolyline () const 
Return contents of the geometry as a polyline if wkbType is WKBLineString, otherwise an empty list. More...  
QPointF  asQPointF () const 
Return contents of the geometry as a QPointF if wkbType is WKBPoint, otherwise returns a null QPointF. More...  
QPolygonF  asQPolygonF () const 
Return contents of the geometry as a QPolygonF. More...  
int  avoidIntersections (const QList< QgsVectorLayer *> &avoidIntersectionsLayers, const QHash< QgsVectorLayer *, QSet< QgsFeatureId > > &ignoreFeatures=(QHash< QgsVectorLayer *, QSet< QgsFeatureId > >())) 
Modifies geometry to avoid intersections with the layers specified in project properties. More...  
QgsRectangle  boundingBox () const 
Returns the bounding box of the geometry. More...  
QgsGeometry  buffer (double distance, int segments) const 
Returns a buffer region around this geometry having the given width and with a specified number of segments used to approximate curves. More...  
QgsGeometry  buffer (double distance, int segments, EndCapStyle endCapStyle, JoinStyle joinStyle, double mitreLimit) const 
Returns a buffer region around the geometry, with additional style options. More...  
QgsGeometry  centroid () const 
Returns the center of mass of a geometry. More...  
QgsGeometry  clipped (const QgsRectangle &rectangle) 
Clips the geometry using the specified rectangle. More...  
double  closestSegmentWithContext (const QgsPointXY &point, QgsPointXY &minDistPoint, int &afterVertex, double *leftOf=nullptr, double epsilon=DEFAULT_SEGMENT_EPSILON) const 
Searches for the closest segment of geometry to the given point. More...  
QgsPointXY  closestVertex (const QgsPointXY &point, int &atVertex, int &beforeVertex, int &afterVertex, double &sqrDist) const 
Returns the vertex closest to the given point, the corresponding vertex index, squared distance snap point / target point and the indices of the vertices before and after the closest vertex. More...  
double  closestVertexWithContext (const QgsPointXY &point, int &atVertex) const 
Searches for the closest vertex in this geometry to the given point. More...  
QgsGeometry  combine (const QgsGeometry &geometry) const 
Returns a geometry representing all the points in this geometry and other (a union geometry operation). More...  
bool  contains (const QgsPointXY *p) const 
Test for containment of a point (uses GEOS) More...  
bool  contains (const QgsGeometry &geometry) const 
Test for if geometry is contained in another (uses GEOS) More...  
bool  convertToMultiType () 
Converts single type geometry into multitype geometry e.g. More...  
bool  convertToSingleType () 
Converts multi type geometry into single type geometry e.g. More...  
void  convertToStraightSegment () 
Converts the geometry to straight line segments, if it is a curved geometry type. More...  
QgsGeometry  convertToType (QgsWkbTypes::GeometryType destType, bool destMultipart=false) const 
Try to convert the geometry to the requested type. More...  
QgsGeometry  convexHull () const 
Returns the smallest convex polygon that contains all the points in the geometry. More...  
bool  crosses (const QgsGeometry &geometry) const 
Test for if geometry crosses another (uses GEOS) More...  
QgsGeometry  delaunayTriangulation (double tolerance=0.0, bool edgesOnly=false) const 
Returns the Delaunay triangulation for the vertices of the geometry. More...  
bool  deletePart (int partNum) 
Delete part identified by the part number. More...  
bool  deleteRing (int ringNum, int partNum=0) 
Delete a ring in polygon or multipolygon. More...  
bool  deleteVertex (int atVertex) 
Deletes the vertex at the given position number and item (first number is index 0) Returns false if atVertex does not correspond to a valid vertex on this geometry (including if this geometry is a Point), or if the number of remaining vertices in the linestring would be less than two. More...  
QgsGeometry  densifyByCount (int extraNodesPerSegment) const 
Returns a copy of the geometry which has been densified by adding the specified number of extra nodes within each segment of the geometry. More...  
QgsGeometry  densifyByDistance (double distance) const 
Densifies the geometry by adding regularly placed extra nodes inside each segment so that the maximum distance between any two nodes does not exceed the specified distance. More...  
QgsGeometry  difference (const QgsGeometry &geometry) const 
Returns a geometry representing the points making up this geometry that do not make up other. More...  
bool  disjoint (const QgsGeometry &geometry) const 
Test for if geometry is disjoint of another (uses GEOS) More...  
double  distance (const QgsGeometry &geom) const 
Returns the minimum distance between this geometry and another geometry, using GEOS. More...  
double  distanceToVertex (int vertex) const 
Returns the distance along this geometry from its first vertex to the specified vertex. More...  
void  draw (QPainter &p) const 
Draws the geometry onto a QPainter. More...  
bool  equals (const QgsGeometry &geometry) const 
Test for if geometry equals another (uses GEOS) More...  
QString  exportToGeoJSON (int precision=17) const 
Exports the geometry to GeoJSON. More...  
GEOSGeometry *  exportToGeos (double precision=0) const 
Returns a geos geometry  caller takes ownership of the object (should be deleted with GEOSGeom_destroy_r) More...  
QByteArray  exportToWkb () const 
Export the geometry to WKB. More...  
QString  exportToWkt (int precision=17) const 
Exports the geometry to WKT. More...  
QgsGeometry  extendLine (double startDistance, double endDistance) const 
Extends a (multi)line geometry by extrapolating out the start or end of the line by a specified distance. More...  
QgsGeometry  extrude (double x, double y) 
Returns an extruded version of this geometry. More...  
void  fromGeos (GEOSGeometry *geos) 
Set the geometry, feeding in a geometry in GEOS format. More...  
void  fromWkb (unsigned char *wkb, int length) 
Set the geometry, feeding in the buffer containing OGC WellKnown Binary and the buffer's length. More...  
void  fromWkb (const QByteArray &wkb) 
Set the geometry, feeding in the buffer containing OGC WellKnown Binary. More...  
QgsAbstractGeometry *  geometry () const 
Returns the underlying geometry store. More...  
bool  insertVertex (double x, double y, int beforeVertex) 
Insert a new vertex before the given vertex index, ring and item (first number is index 0) If the requested vertex number (beforeVertex.back()) is greater than the last actual vertex on the requested ring and item, it is assumed that the vertex is to be appended instead of inserted. More...  
bool  insertVertex (const QgsPoint &point, int beforeVertex) 
Insert a new vertex before the given vertex index, ring and item (first number is index 0) If the requested vertex number (beforeVertex.back()) is greater than the last actual vertex on the requested ring and item, it is assumed that the vertex is to be appended instead of inserted. More...  
QgsGeometry  interpolate (double distance) const 
Return interpolated point on line at distance. More...  
double  interpolateAngle (double distance) const 
Returns the angle parallel to the linestring or polygon boundary at the specified distance along the geometry. More...  
QgsGeometry  intersection (const QgsGeometry &geometry) const 
Returns a geometry representing the points shared by this geometry and other. More...  
bool  intersects (const QgsRectangle &r) const 
Test for intersection with a rectangle (uses GEOS) More...  
bool  intersects (const QgsGeometry &geometry) const 
Test for intersection with a geometry (uses GEOS) More...  
bool  isEmpty () const 
Returns true if the geometry is empty (eg a linestring with no vertices, or a collection with no geometries). More...  
bool  isGeosEqual (const QgsGeometry &) const 
Compares the geometry with another geometry using GEOS. More...  
bool  isGeosValid () const 
Checks validity of the geometry using GEOS. More...  
bool  isMultipart () const 
Returns true if WKB of the geometry is of WKBMulti* type. More...  
bool  isNull () const 
Returns true if the geometry is null (ie, contains no underlying geometry accessible via geometry() ). More...  
bool  isSimple () const 
Determines whether the geometry is simple (according to OGC definition), i.e. More...  
double  length () const 
Returns the length of geometry using GEOS. More...  
double  lineLocatePoint (const QgsGeometry &point) const 
Returns a distance representing the location along this linestring of the closest point on this linestring geometry to the specified point. More...  
QgsGeometry  makeDifference (const QgsGeometry &other) const 
Returns the geometry formed by modifying this geometry such that it does not intersect the other geometry. More...  
int  makeDifferenceInPlace (const QgsGeometry &other) 
Changes this geometry such that it does not intersect the other geometry. More...  
QgsGeometry  makeValid () 
Attempts to make an invalid geometry valid without losing vertices. More...  
void  mapToPixel (const QgsMapToPixel &mtp) 
Transforms the geometry from map units to pixels in place. More...  
QgsGeometry  mergeLines () const 
Merges any connected lines in a LineString/MultiLineString geometry and converts them to single line strings. More...  
bool  moveVertex (double x, double y, int atVertex) 
Moves the vertex at the given position number and item (first number is index 0) to the given coordinates. More...  
bool  moveVertex (const QgsPoint &p, int atVertex) 
Moves the vertex at the given position number and item (first number is index 0) to the given coordinates. More...  
QgsGeometry  nearestPoint (const QgsGeometry &other) const 
Returns the nearest point on this geometry to another geometry. More...  
QgsGeometry  offsetCurve (double distance, int segments, JoinStyle joinStyle, double mitreLimit) const 
Returns an offset line at a given distance and side from an input line. More...  
operator bool () const  
Returns true if the geometry is non empty (ie, isNull() returns false), or false if it is an empty, uninitialized geometry (ie, isNull() returns true). More...  
operator QVariant () const  
Allows direct construction of QVariants from geometry. More...  
QgsGeometry &  operator= (QgsGeometry const &rhs) 
Assignments will prompt a deep copy of the object. More...  
QgsGeometry  orientedMinimumBoundingBox (double &area, double &angle, double &width, double &height) const 
Returns the oriented minimum bounding box for the geometry, which is the smallest (by area) rotated rectangle which fully encompasses the geometry. More...  
QgsGeometry  orthogonalize (double tolerance=1.0E8, int maxIterations=1000, double angleThreshold=15.0) const 
Attempts to orthogonalize a line or polygon geometry by shifting vertices to make the geometries angles either right angles or flat lines. More...  
bool  overlaps (const QgsGeometry &geometry) const 
Test for if geometry overlaps another (uses GEOS) More...  
QgsGeometry  pointOnSurface () const 
Returns a point guaranteed to lie on the surface of a geometry. More...  
QgsGeometry  poleOfInaccessibility (double precision, double *distanceToBoundary=nullptr) const 
Calculates the approximate pole of inaccessibility for a surface, which is the most distant internal point from the boundary of the surface. More...  
QgsGeometry  removeInteriorRings (double minimumAllowedArea=1) const 
Removes the interior rings from a (multi)polygon geometry. More...  
bool  requiresConversionToStraightSegments () const 
Returns true if the geometry is a curved geometry type which requires conversion to display as straight line segments. More...  
int  reshapeGeometry (const QgsLineString &reshapeLineString) 
Replaces a part of this geometry with another line. More...  
int  rotate (double rotation, const QgsPointXY ¢er) 
Rotate this geometry around the Z axis. More...  
void  setGeometry (QgsAbstractGeometry *geometry) 
Sets the underlying geometry store. More...  
QgsGeometry  shortestLine (const QgsGeometry &other) const 
Returns the shortest line joining this geometry to another geometry. More...  
QgsGeometry  simplify (double tolerance) const 
Returns a simplified version of this geometry using a specified tolerance value. More...  
QgsGeometry  singleSidedBuffer (double distance, int segments, BufferSide side, JoinStyle joinStyle=JoinStyleRound, double mitreLimit=2.0) const 
Returns a single sided buffer for a (multi)line geometry. More...  
QgsGeometry  smooth (const unsigned int iterations=1, const double offset=0.25, double minimumDistance=1.0, double maxAngle=180.0) const 
Smooths a geometry by rounding off corners using the Chaikin algorithm. More...  
int  splitGeometry (const QList< QgsPointXY > &splitLine, QList< QgsGeometry > &newGeometries, bool topological, QList< QgsPointXY > &topologyTestPoints) 
Splits this geometry according to a given line. More...  
double  sqrDistToVertexAt (QgsPointXY &point SIP_IN, int atVertex) const 
Returns the squared cartesian distance between the given point to the given vertex index (vertex at the given position number, ring and item (first number is index 0)) More...  
QgsGeometry  subdivide (int maxNodes=256) const 
Subdivides the geometry. More...  
QgsGeometry  symDifference (const QgsGeometry &geometry) const 
Returns a geometry representing the points making up this geometry that do not make up other. More...  
bool  touches (const QgsGeometry &geometry) const 
Test for if geometry touch another (uses GEOS) More...  
int  transform (const QgsCoordinateTransform &ct) 
Transform this geometry as described by CoordinateTransform ct. More...  
int  transform (const QTransform &ct) 
Transform this geometry as described by QTransform ct. More...  
int  translate (double dx, double dy) 
Translate this geometry by dx, dy. More...  
QgsWkbTypes::GeometryType  type () const 
Returns type of the geometry as a QgsWkbTypes::GeometryType. More...  
void  validateGeometry (QList< QgsGeometry::Error > &errors, ValidationMethod method=ValidatorQgisInternal) 
Validate geometry and produce a list of geometry errors. More...  
QgsPointXY  vertexAt (int atVertex) const 
Returns coordinates of a vertex. More...  
bool  vertexIdFromVertexNr (int nr, QgsVertexId &id) const 
Calculates the vertex ID from a vertex number. More...  
int  vertexNrFromVertexId (QgsVertexId i) const 
Returns the vertex number corresponding to a vertex idd. More...  
QgsGeometry  voronoiDiagram (const QgsGeometry &extent=QgsGeometry(), double tolerance=0.0, bool edgesOnly=false) const 
Creates a Voronoi diagram for the nodes contained within the geometry. More...  
bool  within (const QgsGeometry &geometry) const 
Test for if geometry is within another (uses GEOS) More...  
QgsWkbTypes::Type  wkbType () const 
Returns type of the geometry as a WKB type (point / linestring / polygon etc.) More...  
Static Public Member Functions  
static QgsGeometry  collectGeometry (const QList< QgsGeometry > &geometries) 
Creates a new multipart geometry from a list of QgsGeometry objects. More...  
static bool  compare (const QgsPolyline &p1, const QgsPolyline &p2, double epsilon=4 *std::numeric_limits< double >::epsilon()) 
Compares two polylines for equality within a specified tolerance. More...  
static bool  compare (const QgsPolygon &p1, const QgsPolygon &p2, double epsilon=4 *std::numeric_limits< double >::epsilon()) 
Compares two polygons for equality within a specified tolerance. More...  
static bool  compare (const QgsMultiPolygon &p1, const QgsMultiPolygon &p2, double epsilon=4 *std::numeric_limits< double >::epsilon()) 
Compares two multipolygons for equality within a specified tolerance. More...  
static void  convertPointList (const QList< QgsPointXY > &input, QgsPointSequence &output) 
Upgrades a point list from QgsPointXY to QgsPointV2. More...  
static void  convertPointList (const QgsPointSequence &input, QList< QgsPointXY > &output) 
Downgrades a point list from QgsPoint to QgsPoint. More...  
static QgsGeometryEngine *  createGeometryEngine (const QgsAbstractGeometry *geometry) 
Creates and returns a new geometry engine. More...  
static QgsPolygon  createPolygonFromQPolygonF (const QPolygonF &polygon) 
Creates a QgsPolygon from a QPolygonF. More...  
static QgsPolyline  createPolylineFromQPolygonF (const QPolygonF &polygon) 
Creates a QgsPolyline from a QPolygonF. More...  
static QgsGeometry  fromMultiPoint (const QgsMultiPoint &multipoint) 
Creates a new geometry from a QgsMultiPoint object. More...  
static QgsGeometry  fromMultiPolygon (const QgsMultiPolygon &multipoly) 
Creates a new geometry from a QgsMultiPolygon. More...  
static QgsGeometry  fromMultiPolyline (const QgsMultiPolyline &multiline) 
Creates a new geometry from a QgsMultiPolyline object. More...  
static QgsGeometry  fromPoint (const QgsPointXY &point) 
Creates a new geometry from a QgsPointXY object. More...  
static QgsGeometry  fromPolygon (const QgsPolygon &polygon) 
Creates a new geometry from a QgsPolygon. More...  
static QgsGeometry  fromPolyline (const QgsPolyline &polyline) 
Creates a new geometry from a QgsPolyline object. More...  
static QgsGeometry  fromQPointF (QPointF point) 
Construct geometry from a QPointF. More...  
static QgsGeometry  fromQPolygonF (const QPolygonF &polygon) 
Construct geometry from a QPolygonF. More...  
static QgsGeometry  fromRect (const QgsRectangle &rect) 
Creates a new geometry from a QgsRectangle. More...  
static QgsGeometry  fromWkt (const QString &wkt) 
Creates a new geometry from a WKT string. More...  
static GEOSContextHandle_t  getGEOSHandler () 
Return GEOS context handle. More...  
static QgsGeometry  polygonize (const QList< QgsGeometry > &geometries) 
Creates a GeometryCollection geometry containing possible polygons formed from the constituent linework of a set of geometries. More...  
static QgsGeometry  unaryUnion (const QList< QgsGeometry > &geometries) 
Compute the unary union on a list of geometries. More...  
A geometry is the spatial representation of a feature.
Since QGIS 2.10, QgsGeometry acts as a generic container for geometry objects. QgsGeometry is implicitly shared, so making copies of geometries is inexpensive. The geometry container class can also be stored inside a QVariant object.
The actual geometry representation is stored as a QgsAbstractGeometry within the container, and can be accessed via the geometry() method or set using the setGeometry() method.
Definition at line 96 of file qgsgeometry.h.
Side of line to buffer.
Enumerator  

SideLeft  Buffer to left of line. 
SideRight  Buffer to right of line. 
Definition at line 574 of file qgsgeometry.h.
End cap styles for buffers.
Enumerator  

CapRound  Round cap. 
CapFlat  Flat cap (in line with start/end of line) 
CapSquare  Square cap (extends past start/end of line by buffer distance) 
Definition at line 581 of file qgsgeometry.h.
Join styles for buffers.
Enumerator  

JoinStyleRound  Use rounded joins. 
JoinStyleMitre  Use mitred joins. 
JoinStyleBevel  Use beveled joins. 
Definition at line 589 of file qgsgeometry.h.
Available methods for validating geometries.
Enumerator  

ValidatorQgisInternal  Use internal QgsGeometryValidator method. 
ValidatorGeos  Use GEOS validation methods. 
Definition at line 979 of file qgsgeometry.h.
QgsGeometry::QgsGeometry  (  ) 
Constructor.
Definition at line 56 of file qgsgeometry.cpp.
QgsGeometry::QgsGeometry  (  const QgsGeometry &  other  ) 
Copy constructor will prompt a deep copy of the object.
Definition at line 72 of file qgsgeometry.cpp.

explicit 
Creates a geometry from an abstract geometry object.
Ownership of geom is transferred.
Definition at line 66 of file qgsgeometry.cpp.
QgsGeometry::~QgsGeometry  (  ) 
Definition at line 60 of file qgsgeometry.cpp.
int QgsGeometry::addPart  (  const QList< QgsPointXY > &  points, 
QgsWkbTypes::GeometryType  geomType = QgsWkbTypes::UnknownGeometry 

) 
Adds a new part to a the geometry.
points  points describing part to add 
geomType  default geometry type to create if no existing geometry 
Definition at line 650 of file qgsgeometry.cpp.
int QgsGeometry::addPart  (  const QgsPointSequence &  points, 
QgsWkbTypes::GeometryType  geomType = QgsWkbTypes::UnknownGeometry 

) 
Adds a new part to a the geometry.
points  points describing part to add 
geomType  default geometry type to create if no existing geometry 
Definition at line 657 of file qgsgeometry.cpp.
int QgsGeometry::addPart  (  QgsAbstractGeometry *  part, 
QgsWkbTypes::GeometryType  geomType = QgsWkbTypes::UnknownGeometry 

) 
Adds a new part to this geometry.
part  part to add (ownership is transferred) 
geomType  default geometry type to create if no existing geometry 
Definition at line 673 of file qgsgeometry.cpp.
int QgsGeometry::addPart  (  GEOSGeometry *  newPart  ) 
Adds a new island polygon to a multipolygon feature.
newPart  part to add. Ownership is NOT transferred. 
Definition at line 747 of file qgsgeometry.cpp.
int QgsGeometry::addPart  (  const QgsGeometry &  newPart  ) 
Adds a new island polygon to a multipolygon feature.
Definition at line 702 of file qgsgeometry.cpp.
int QgsGeometry::addRing  (  const QList< QgsPointXY > &  ring  ) 
Adds a new ring to this geometry.
This makes only sense for polygon and multipolygons.
Definition at line 629 of file qgsgeometry.cpp.
int QgsGeometry::addRing  (  QgsCurve *  ring  ) 
Adds a new ring to this geometry.
This makes only sense for polygon and multipolygons.
Definition at line 637 of file qgsgeometry.cpp.
void QgsGeometry::adjacentVertices  (  int  atVertex, 
int &  beforeVertex,  
int &  afterVertex  
)  const 
Returns the indexes of the vertices before and after the given vertex index.
This function takes into account the following factors:
Definition at line 404 of file qgsgeometry.cpp.
double QgsGeometry::angleAtVertex  (  int  vertex  )  const 
Returns the bisector angle for this geometry at the specified vertex.
vertex  vertex index to calculate bisector angle at 
Definition at line 364 of file qgsgeometry.cpp.
double QgsGeometry::area  (  )  const 
Returns the area of the geometry using GEOS.
Definition at line 1357 of file qgsgeometry.cpp.
QList< QgsGeometry > QgsGeometry::asGeometryCollection  (  )  const 
Return contents of the geometry as a list of geometries.
Definition at line 1867 of file qgsgeometry.cpp.
QgsMultiPoint QgsGeometry::asMultiPoint  (  )  const 
Return contents of the geometry as a multi point if wkbType is WKBMultiPoint, otherwise an empty list.
Definition at line 1241 of file qgsgeometry.cpp.
QgsMultiPolygon QgsGeometry::asMultiPolygon  (  )  const 
Return contents of the geometry as a multi polygon if wkbType is WKBMultiPolygon, otherwise an empty list.
Definition at line 1314 of file qgsgeometry.cpp.
QgsMultiPolyline QgsGeometry::asMultiPolyline  (  )  const 
Return contents of the geometry as a multi linestring if wkbType is WKBMultiLineString, otherwise an empty list.
Definition at line 1265 of file qgsgeometry.cpp.
QgsPointXY QgsGeometry::asPoint  (  )  const 
Return contents of the geometry as a point if wkbType is WKBPoint, otherwise returns [0,0].
Definition at line 1144 of file qgsgeometry.cpp.
QgsPolygon QgsGeometry::asPolygon  (  )  const 
Return contents of the geometry as a polygon if wkbType is WKBPolygon, otherwise an empty list.
Definition at line 1204 of file qgsgeometry.cpp.
QgsPolyline QgsGeometry::asPolyline  (  )  const 
Return contents of the geometry as a polyline if wkbType is WKBLineString, otherwise an empty list.
Definition at line 1159 of file qgsgeometry.cpp.
QPointF QgsGeometry::asQPointF  (  )  const 
Return contents of the geometry as a QPointF if wkbType is WKBPoint, otherwise returns a null QPointF.
Definition at line 1893 of file qgsgeometry.cpp.
QPolygonF QgsGeometry::asQPolygonF  (  )  const 
Return contents of the geometry as a QPolygonF.
If geometry is a linestring, then the result will be an open QPolygonF. If the geometry is a polygon, then the result will be a closed QPolygonF of the geometry's exterior ring.
Definition at line 1899 of file qgsgeometry.cpp.
int QgsGeometry::avoidIntersections  (  const QList< QgsVectorLayer *> &  avoidIntersectionsLayers, 
const QHash< QgsVectorLayer *, QSet< QgsFeatureId > > &  ignoreFeatures = ( QHash<QgsVectorLayer *, QSet<QgsFeatureId> >() ) 

) 
Modifies geometry to avoid intersections with the layers specified in project properties.
avoidIntersectionsLayers  list of layers to check for intersections 
ignoreFeatures  possibility to give a list of features where intersections should be ignored (not available in Python bindings) 
Definition at line 1958 of file qgsgeometry.cpp.
QgsRectangle QgsGeometry::boundingBox  (  )  const 
Returns the bounding box of the geometry.
Definition at line 879 of file qgsgeometry.cpp.
QgsGeometry QgsGeometry::buffer  (  double  distance, 
int  segments  
)  const 
Returns a buffer region around this geometry having the given width and with a specified number of segments used to approximate curves.
Definition at line 1400 of file qgsgeometry.cpp.
QgsGeometry QgsGeometry::buffer  (  double  distance, 
int  segments,  
EndCapStyle  endCapStyle,  
JoinStyle  joinStyle,  
double  mitreLimit  
)  const 
Returns a buffer region around the geometry, with additional style options.
distance  buffer distance 
segments  for round joins, number of segments to approximate quartercircle 
endCapStyle  end cap style 
joinStyle  join style for corners in geometry 
mitreLimit  limit on the mitre ratio used for very sharp corners (JoinStyleMitre only) 
Definition at line 1416 of file qgsgeometry.cpp.
QgsGeometry QgsGeometry::centroid  (  )  const 
Returns the center of mass of a geometry.
Definition at line 1580 of file qgsgeometry.cpp.
QgsGeometry QgsGeometry::clipped  (  const QgsRectangle &  rectangle  ) 
Clips the geometry using the specified rectangle.
Performs a fast, nonrobust intersection between the geometry and a rectangle. The returned geometry may be invalid.
Definition at line 2116 of file qgsgeometry.cpp.
double QgsGeometry::closestSegmentWithContext  (  const QgsPointXY &  point, 
QgsPointXY &  minDistPoint,  
int &  afterVertex,  
double *  leftOf = nullptr , 

double  epsilon = DEFAULT_SEGMENT_EPSILON 

)  const 
Searches for the closest segment of geometry to the given point.
point  Specifies the point for search 
minDistPoint  Receives the nearest point on the segment 
afterVertex  Receives index of the vertex after the closest segment. The vertex before the closest segment is always afterVertex  1 
leftOf  Out: Returns if the point lies on the left of right side of the segment ( < 0 means left, > 0 means right ) 
epsilon  epsilon for segment snapping 
Definition at line 599 of file qgsgeometry.cpp.
QgsPointXY QgsGeometry::closestVertex  (  const QgsPointXY &  point, 
int &  atVertex,  
int &  beforeVertex,  
int &  afterVertex,  
double &  sqrDist  
)  const 
Returns the vertex closest to the given point, the corresponding vertex index, squared distance snap point / target point and the indices of the vertices before and after the closest vertex.
point  point to search for 
atVertex  will be set to the vertex index of the closest found vertex 
beforeVertex  will be set to the vertex index of the previous vertex from the closest one. Will be set to 1 if not present. 
afterVertex  will be set to the vertex index of the next vertex after the closest one. Will be set to 1 if not present. 
sqrDist  will be set to the square distance between the closest vertex and the specified point 
Definition at line 324 of file qgsgeometry.cpp.
double QgsGeometry::closestVertexWithContext  (  const QgsPointXY &  point, 
int &  atVertex  
)  const 
Searches for the closest vertex in this geometry to the given point.
point  Specifiest the point for search 
atVertex  Receives index of the closest vertex 
Definition at line 583 of file qgsgeometry.cpp.

static 
Creates a new multipart geometry from a list of QgsGeometry objects.
Definition at line 219 of file qgsgeometry.cpp.
QgsGeometry QgsGeometry::combine  (  const QgsGeometry &  geometry  )  const 
Returns a geometry representing all the points in this geometry and other (a union geometry operation).
Definition at line 1787 of file qgsgeometry.cpp.

static 
Compares two polylines for equality within a specified tolerance.
p1  first polyline 
p2  second polyline 
epsilon  maximum difference for coordinates between the polylines 
Definition at line 2372 of file qgsgeometry.cpp.

static 
Compares two polygons for equality within a specified tolerance.
p1  first polygon 
p2  second polygon 
epsilon  maximum difference for coordinates between the polygons 
Definition at line 2385 of file qgsgeometry.cpp.

static 
Compares two multipolygons for equality within a specified tolerance.
p1  first multipolygon 
p2  second multipolygon 
epsilon  maximum difference for coordinates between the multipolygons 
Definition at line 2399 of file qgsgeometry.cpp.
bool QgsGeometry::contains  (  const QgsPointXY *  p  )  const 
Test for containment of a point (uses GEOS)
Definition at line 971 of file qgsgeometry.cpp.
bool QgsGeometry::contains  (  const QgsGeometry &  geometry  )  const 
Test for if geometry is contained in another (uses GEOS)
Definition at line 983 of file qgsgeometry.cpp.

static 
Upgrades a point list from QgsPointXY to QgsPointV2.
input  list of QgsPointXY objects to be upgraded 
output  destination for list of points converted to QgsPointV2 
Definition at line 2278 of file qgsgeometry.cpp.

static 
bool QgsGeometry::convertToMultiType  (  ) 
Converts single type geometry into multitype geometry e.g.
a polygon into a multipolygon geometry with one polygon If it is already a multipart geometry, it will return true and not change the geometry.
Definition at line 1096 of file qgsgeometry.cpp.
bool QgsGeometry::convertToSingleType  (  ) 
Converts multi type geometry into single type geometry e.g.
a multipolygon into a polygon geometry. Only the first part of the multi geometry will be retained. If it is already a single part geometry, it will return true and not change the geometry.
Definition at line 1121 of file qgsgeometry.cpp.
void QgsGeometry::convertToStraightSegment  (  ) 
Converts the geometry to straight line segments, if it is a curved geometry type.
Definition at line 2060 of file qgsgeometry.cpp.
QgsGeometry QgsGeometry::convertToType  (  QgsWkbTypes::GeometryType  destType, 
bool  destMultipart = false 

)  const 
Try to convert the geometry to the requested type.
destType  the geometry type to be converted to 
destMultipart  determines if the output geometry will be multipart or not 
Definition at line 1078 of file qgsgeometry.cpp.
QgsGeometry QgsGeometry::convexHull  (  )  const 
Returns the smallest convex polygon that contains all the points in the geometry.
Definition at line 1621 of file qgsgeometry.cpp.

static 
Creates and returns a new geometry engine.
Definition at line 2903 of file qgsgeometry.cpp.

static 
Creates a QgsPolygon from a QPolygonF.
polygon  source polygon 
Definition at line 2354 of file qgsgeometry.cpp.

static 
Creates a QgsPolyline from a QPolygonF.
polygon  source polygon 
Definition at line 2361 of file qgsgeometry.cpp.
bool QgsGeometry::crosses  (  const QgsGeometry &  geometry  )  const 
Test for if geometry crosses another (uses GEOS)
Definition at line 1049 of file qgsgeometry.cpp.
QgsGeometry QgsGeometry::delaunayTriangulation  (  double  tolerance = 0.0 , 
bool  edgesOnly = false 

)  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.
Definition at line 1647 of file qgsgeometry.cpp.
bool QgsGeometry::deletePart  (  int  partNum  ) 
Delete part identified by the part number.
Definition at line 1940 of file qgsgeometry.cpp.
bool QgsGeometry::deleteRing  (  int  ringNum, 
int  partNum = 0 

) 
Delete a ring in polygon or multipolygon.
Ring 0 is outer ring and can't be deleted.
Definition at line 1928 of file qgsgeometry.cpp.
bool QgsGeometry::deleteVertex  (  int  atVertex  ) 
Deletes the vertex at the given position number and item (first number is index 0) Returns false if atVertex does not correspond to a valid vertex on this geometry (including if this geometry is a Point), or if the number of remaining vertices in the linestring would be less than two.
It is up to the caller to distinguish between these error conditions. (Or maybe we add another method to this object to help make the distinction?)
Definition at line 461 of file qgsgeometry.cpp.
QgsGeometry QgsGeometry::densifyByCount  (  int  extraNodesPerSegment  )  const 
Returns a copy of the geometry which has been densified by adding the specified number of extra nodes within each segment of the geometry.
If the geometry has z or m values present then these will be linearly interpolated at the added nodes. Curved geometry types are automatically segmentized by this routine.
Definition at line 1566 of file qgsgeometry.cpp.
QgsGeometry QgsGeometry::densifyByDistance  (  double  distance  )  const 
Densifies the geometry by adding regularly placed extra nodes inside each segment so that the maximum distance between any two nodes does not exceed the specified distance.
E.g. specifying a distance 3 would cause the segment [0 0] > [10 0] to be converted to [0 0] > [2.5 0] > [5 0] > [7.5 0] > [10 0], since 3 extra nodes are required on the segment and spacing these at 2.5 increments allows them to be evenly spaced over the segment. If the geometry has z or m values present then these will be linearly interpolated at the added nodes. Curved geometry types are automatically segmentized by this routine.
Definition at line 1573 of file qgsgeometry.cpp.
QgsGeometry QgsGeometry::difference  (  const QgsGeometry &  geometry  )  const 
Returns a geometry representing the points making up this geometry that do not make up other.
Definition at line 1821 of file qgsgeometry.cpp.
bool QgsGeometry::disjoint  (  const QgsGeometry &  geometry  )  const 
Test for if geometry is disjoint of another (uses GEOS)
Definition at line 994 of file qgsgeometry.cpp.
double QgsGeometry::distance  (  const QgsGeometry &  geom  )  const 
Returns the minimum distance between this geometry and another geometry, using GEOS.
Will return a negative value if a geometry is missing.
geom  geometry to find minimum distance to 
Definition at line 1389 of file qgsgeometry.cpp.
double QgsGeometry::distanceToVertex  (  int  vertex  )  const 
Returns the distance along this geometry from its first vertex to the specified vertex.
vertex  vertex index to calculate distance to 
Definition at line 348 of file qgsgeometry.cpp.
void QgsGeometry::draw  (  QPainter &  p  )  const 
Draws the geometry onto a QPainter.
p  destination QPainter 
Definition at line 2128 of file qgsgeometry.cpp.
bool QgsGeometry::equals  (  const QgsGeometry &  geometry  )  const 
Test for if geometry equals another (uses GEOS)
Definition at line 1005 of file qgsgeometry.cpp.
QString QgsGeometry::exportToGeoJSON  (  int  precision = 17  )  const 
Exports the geometry to GeoJSON.
Definition at line 1069 of file qgsgeometry.cpp.
GEOSGeometry * QgsGeometry::exportToGeos  (  double  precision = 0  )  const 
Returns a geos geometry  caller takes ownership of the object (should be deleted with GEOSGeom_destroy_r)
precision  The precision of the grid to which to snap the geometry vertices. If 0, no snapping is performed. 
Definition at line 264 of file qgsgeometry.cpp.
QByteArray QgsGeometry::exportToWkb  (  )  const 
QString QgsGeometry::exportToWkt  (  int  precision = 17  )  const 
Exports the geometry to WKT.
Definition at line 1060 of file qgsgeometry.cpp.
QgsGeometry QgsGeometry::extendLine  (  double  startDistance, 
double  endDistance  
)  const 
Extends a (multi)line geometry by extrapolating out the start or end of the line by a specified distance.
Lines are extended using the bearing of the first or last segment in the line.
Definition at line 1511 of file qgsgeometry.cpp.
QgsGeometry QgsGeometry::extrude  (  double  x, 
double  y  
) 
Returns an extruded version of this geometry.
Definition at line 1855 of file qgsgeometry.cpp.
void QgsGeometry::fromGeos  (  GEOSGeometry *  geos  ) 
Set the geometry, feeding in a geometry in GEOS format.
This class will take ownership of the buffer.
Definition at line 316 of file qgsgeometry.cpp.

static 
Creates a new geometry from a QgsMultiPoint object.
Definition at line 174 of file qgsgeometry.cpp.

static 
Creates a new geometry from a QgsMultiPolygon.
Definition at line 194 of file qgsgeometry.cpp.

static 
Creates a new geometry from a QgsMultiPolyline object.
Definition at line 184 of file qgsgeometry.cpp.

static 
Creates a new geometry from a QgsPointXY object.
Definition at line 144 of file qgsgeometry.cpp.

static 
Creates a new geometry from a QgsPolygon.
Definition at line 164 of file qgsgeometry.cpp.

static 
Creates a new geometry from a QgsPolyline object.
Definition at line 154 of file qgsgeometry.cpp.

static 
Construct geometry from a QPointF.
point  source QPointF 
Definition at line 2337 of file qgsgeometry.cpp.

static 
Construct geometry from a QPolygonF.
If the polygon is closed than the resultant geometry will be a polygon, if it is open than the geometry will be a polyline.
polygon  source QPolygonF 
Definition at line 2342 of file qgsgeometry.cpp.

static 
Creates a new geometry from a QgsRectangle.
Definition at line 204 of file qgsgeometry.cpp.
void QgsGeometry::fromWkb  (  unsigned char *  wkb, 
int  length  
) 
Set the geometry, feeding in the buffer containing OGC WellKnown Binary and the buffer's length.
This class will take ownership of the buffer.
Definition at line 239 of file qgsgeometry.cpp.
void QgsGeometry::fromWkb  (  const QByteArray &  wkb  ) 
Set the geometry, feeding in the buffer containing OGC WellKnown Binary.
Definition at line 252 of file qgsgeometry.cpp.

static 
Creates a new geometry from a WKT string.
Definition at line 134 of file qgsgeometry.cpp.
QgsAbstractGeometry * QgsGeometry::geometry  (  )  const 
Returns the underlying geometry store.
Definition at line 107 of file qgsgeometry.cpp.

static 
Return GEOS context handle.
Definition at line 2332 of file qgsgeometry.cpp.
bool QgsGeometry::insertVertex  (  double  x, 
double  y,  
int  beforeVertex  
) 
Insert a new vertex before the given vertex index, ring and item (first number is index 0) If the requested vertex number (beforeVertex.back()) is greater than the last actual vertex on the requested ring and item, it is assumed that the vertex is to be appended instead of inserted.
Returns false if atVertex does not correspond to a valid vertex on this geometry (including if this geometry is a Point). It is up to the caller to distinguish between these error conditions. (Or maybe we add another method to this object to help make the distinction?)
Definition at line 496 of file qgsgeometry.cpp.
bool QgsGeometry::insertVertex  (  const QgsPoint &  point, 
int  beforeVertex  
) 
Insert a new vertex before the given vertex index, ring and item (first number is index 0) If the requested vertex number (beforeVertex.back()) is greater than the last actual vertex on the requested ring and item, it is assumed that the vertex is to be appended instead of inserted.
Returns false if atVertex does not correspond to a valid vertex on this geometry (including if this geometry is a Point). It is up to the caller to distinguish between these error conditions. (Or maybe we add another method to this object to help make the distinction?)
Definition at line 522 of file qgsgeometry.cpp.
QgsGeometry QgsGeometry::interpolate  (  double  distance  )  const 
Return interpolated point on line at distance.
Definition at line 1682 of file qgsgeometry.cpp.
double QgsGeometry::interpolateAngle  (  double  distance  )  const 
Returns the angle parallel to the linestring or polygon boundary at the specified distance along the geometry.
Angles are in radians, clockwise from north. If the distance coincides precisely at a node then the average angle from the segment either side of the node is returned.
distance  distance along geometry 
Definition at line 1720 of file qgsgeometry.cpp.
QgsGeometry QgsGeometry::intersection  (  const QgsGeometry &  geometry  )  const 
Returns a geometry representing the points shared by this geometry and other.
Definition at line 1774 of file qgsgeometry.cpp.
bool QgsGeometry::intersects  (  const QgsRectangle &  r  )  const 
Test for intersection with a rectangle (uses GEOS)
Definition at line 954 of file qgsgeometry.cpp.
bool QgsGeometry::intersects  (  const QgsGeometry &  geometry  )  const 
Test for intersection with a geometry (uses GEOS)
Definition at line 960 of file qgsgeometry.cpp.
bool QgsGeometry::isEmpty  (  )  const 
Returns true if the geometry is empty (eg a linestring with no vertices, or a collection with no geometries).
A null geometry will always return true for isEmpty().
Definition at line 297 of file qgsgeometry.cpp.
bool QgsGeometry::isGeosEqual  (  const QgsGeometry &  g  )  const 
Compares the geometry with another geometry using GEOS.
Definition at line 2014 of file qgsgeometry.cpp.
bool QgsGeometry::isGeosValid  (  )  const 
Checks validity of the geometry using GEOS.
Definition at line 1994 of file qgsgeometry.cpp.
bool QgsGeometry::isMultipart  (  )  const 
Returns true if WKB of the geometry is of WKBMulti* type.
Definition at line 307 of file qgsgeometry.cpp.
bool QgsGeometry::isNull  (  )  const 
Returns true if the geometry is null (ie, contains no underlying geometry accessible via geometry() ).
Definition at line 129 of file qgsgeometry.cpp.
bool QgsGeometry::isSimple  (  )  const 
Determines whether the geometry is simple (according to OGC definition), i.e.
it has no anomalous geometric points, such as selfintersection or selftangency. Uses GEOS library for the test.
Definition at line 2005 of file qgsgeometry.cpp.
double QgsGeometry::length  (  )  const 
Returns the length of geometry using GEOS.
Definition at line 1379 of file qgsgeometry.cpp.
double QgsGeometry::lineLocatePoint  (  const QgsGeometry &  point  )  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 
Definition at line 1702 of file qgsgeometry.cpp.
QgsGeometry QgsGeometry::makeDifference  (  const QgsGeometry &  other  )  const 
Returns the geometry formed by modifying this geometry such that it does not intersect the other geometry.
other  geometry that should not be intersect 
Definition at line 861 of file qgsgeometry.cpp.
int QgsGeometry::makeDifferenceInPlace  (  const QgsGeometry &  other  ) 
Changes this geometry such that it does not intersect the other geometry.
other  geometry that should not be intersect 
Definition at line 839 of file qgsgeometry.cpp.
QgsGeometry QgsGeometry::makeValid  (  ) 
Attempts to make an invalid geometry valid without losing vertices.
Definition at line 1975 of file qgsgeometry.cpp.
void QgsGeometry::mapToPixel  (  const QgsMapToPixel &  mtp  ) 
Transforms the geometry from map units to pixels in place.
mtp  map to pixel transform 
Definition at line 2107 of file qgsgeometry.cpp.
QgsGeometry QgsGeometry::mergeLines  (  )  const 
Merges any connected lines in a LineString/MultiLineString geometry and converts them to single line strings.
Definition at line 1804 of file qgsgeometry.cpp.
bool QgsGeometry::moveVertex  (  double  x, 
double  y,  
int  atVertex  
) 
Moves the vertex at the given position number and item (first number is index 0) to the given coordinates.
Returns false if atVertex does not correspond to a valid vertex on this geometry
Definition at line 425 of file qgsgeometry.cpp.
bool QgsGeometry::moveVertex  (  const QgsPoint &  p, 
int  atVertex  
) 
Moves the vertex at the given position number and item (first number is index 0) to the given coordinates.
Returns false if atVertex does not correspond to a valid vertex on this geometry
Definition at line 443 of file qgsgeometry.cpp.
QgsGeometry QgsGeometry::nearestPoint  (  const QgsGeometry &  other  )  const 
Returns the nearest point on this geometry to another geometry.
Definition at line 571 of file qgsgeometry.cpp.
QgsGeometry QgsGeometry::offsetCurve  (  double  distance, 
int  segments,  
JoinStyle  joinStyle,  
double  mitreLimit  
)  const 
Returns an offset line at a given distance and side from an input line.
distance  buffer distance 
segments  for round joins, number of segments to approximate quartercircle 
joinStyle  join style for corners in geometry 
mitreLimit  limit on the mitre ratio used for very sharp corners (JoinStyleMitre only) 
Definition at line 1432 of file qgsgeometry.cpp.
QgsGeometry::operator bool  (  )  const 
Returns true if the geometry is non empty (ie, isNull() returns false), or false if it is an empty, uninitialized geometry (ie, isNull() returns true).
Definition at line 2298 of file qgsgeometry.cpp.

inline 
Allows direct construction of QVariants from geometry.
Definition at line 1268 of file qgsgeometry.h.
QgsGeometry & QgsGeometry::operator=  (  QgsGeometry const &  rhs  ) 
Assignments will prompt a deep copy of the object.
Definition at line 78 of file qgsgeometry.cpp.
QgsGeometry QgsGeometry::orientedMinimumBoundingBox  (  double &  area, 
double &  angle,  
double &  width,  
double &  height  
)  const 
Returns the oriented minimum bounding box for the geometry, which is the smallest (by area) rotated rectangle which fully encompasses the geometry.
The area, angle (clockwise in degrees from North), width and height of the rotated bounding box will also be returned.
Definition at line 888 of file qgsgeometry.cpp.
QgsGeometry QgsGeometry::orthogonalize  (  double  tolerance = 1.0E8 , 
int  maxIterations = 1000 , 

double  angleThreshold = 15.0 

)  const 
Attempts to orthogonalize a line or polygon geometry by shifting vertices to make the geometries angles either right angles or flat lines.
This is an iterative algorithm which will loop until either the vertices are within a specified tolerance of right angles or a set number of maximum iterations is reached. The angle threshold parameter specifies how close to a right angle or straight line an angle must be before it is attempted to be straightened.
Definition at line 947 of file qgsgeometry.cpp.
bool QgsGeometry::overlaps  (  const QgsGeometry &  geometry  )  const 
Test for if geometry overlaps another (uses GEOS)
Definition at line 1027 of file qgsgeometry.cpp.
QgsGeometry QgsGeometry::pointOnSurface  (  )  const 
Returns a point guaranteed to lie on the surface of a geometry.
While the centroid() of a geometry may be located outside of the geometry itself (e.g., for concave shapes), the point on surface will always be inside the geometry.
Definition at line 1597 of file qgsgeometry.cpp.
QgsGeometry QgsGeometry::poleOfInaccessibility  (  double  precision, 
double *  distanceToBoundary = nullptr 

)  const 
Calculates the approximate pole of inaccessibility for a surface, which is the most distant internal point from the boundary of the surface.
This function uses the 'polylabel' algorithm (Vladimir Agafonkin, 2016), which is an iterative approach guaranteed to find the true pole of inaccessibility within a specified tolerance. More precise tolerances require more iterations and will take longer to calculate. Optionally, the distance to the polygon boundary from the pole can be stored.
Definition at line 1614 of file qgsgeometry.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 call unaryUnion() 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 2043 of file qgsgeometry.cpp.
QgsGeometry QgsGeometry::removeInteriorRings  (  double  minimumAllowedArea = 1  )  const 
Removes the interior rings from a (multi)polygon geometry.
If the minimumAllowedArea parameter is specified then only rings smaller than this minimum area will be removed.
Definition at line 712 of file qgsgeometry.cpp.
bool QgsGeometry::requiresConversionToStraightSegments  (  )  const 
Returns true if the geometry is a curved geometry type which requires conversion to display as straight line segments.
Definition at line 2073 of file qgsgeometry.cpp.
int QgsGeometry::reshapeGeometry  (  const QgsLineString &  reshapeLineString  ) 
Replaces a part of this geometry with another line.
Definition at line 819 of file qgsgeometry.cpp.
int QgsGeometry::rotate  (  double  rotation, 
const QgsPointXY &  center  
) 
Rotate this geometry around the Z axis.
rotation  clockwise rotation in degrees 
center  rotation center 
Definition at line 773 of file qgsgeometry.cpp.
void QgsGeometry::setGeometry  (  QgsAbstractGeometry *  geometry  ) 
Sets the underlying geometry store.
Ownership of geometry is transferred.
Definition at line 112 of file qgsgeometry.cpp.
QgsGeometry QgsGeometry::shortestLine  (  const QgsGeometry &  other  )  const 
Returns the shortest line joining this geometry to another geometry.
Definition at line 577 of file qgsgeometry.cpp.
QgsGeometry QgsGeometry::simplify  (  double  tolerance  )  const 
Returns a simplified version of this geometry using a specified tolerance value.
Definition at line 1550 of file qgsgeometry.cpp.
QgsGeometry QgsGeometry::singleSidedBuffer  (  double  distance, 
int  segments,  
BufferSide  side,  
JoinStyle  joinStyle = JoinStyleRound , 

double  mitreLimit = 2.0 

)  const 
Returns a single sided buffer for a (multi)line geometry.
The buffer is only applied to one side of the line.
distance  buffer distance 
segments  for round joins, number of segments to approximate quartercircle 
side  side of geometry to buffer 
joinStyle  join style for corners 
mitreLimit  limit on the mitre ratio used for very sharp corners 
Definition at line 1471 of file qgsgeometry.cpp.
QgsGeometry QgsGeometry::smooth  (  const unsigned int  iterations = 1 , 
const double  offset = 0.25 , 

double  minimumDistance = 1.0 , 

double  maxAngle = 180.0 

)  const 
Smooths a geometry by rounding off corners using the Chaikin algorithm.
This operation roughly doubles the number of vertices in a geometry.
iterations  number of smoothing iterations to run. More iterations results in a smoother geometry 
offset  fraction of line to create new vertices along, between 0 and 1.0, e.g., the default value of 0.25 will create new vertices 25% and 75% along each line segment of the geometry for each iteration. Smaller values result in "tighter" smoothing. 
minimumDistance  minimum segment length to apply smoothing to 
maxAngle  maximum angle at node (0180) at which smoothing will be applied 
Definition at line 2412 of file qgsgeometry.cpp.
int QgsGeometry::splitGeometry  (  const QList< QgsPointXY > &  splitLine, 
QList< QgsGeometry > &  newGeometries,  
bool  topological,  
QList< QgsPointXY > &  topologyTestPoints  
) 
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 
Definition at line 789 of file qgsgeometry.cpp.
double QgsGeometry::sqrDistToVertexAt  (  QgsPointXY &point  SIP_IN, 
int  atVertex  
)  const 
Returns the squared cartesian distance between the given point to the given vertex index (vertex at the given position number, ring and item (first number is index 0))
Definition at line 565 of file qgsgeometry.cpp.
QgsGeometry QgsGeometry::subdivide  (  int  maxNodes = 256  )  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 selfintersections.
The minimum allowed value for maxNodes is 8.
Curved geometries will be segmentized before subdivision.
Definition at line 1658 of file qgsgeometry.cpp.
QgsGeometry QgsGeometry::symDifference  (  const QgsGeometry &  geometry  )  const 
Returns a geometry representing the points making up this geometry that do not make up other.
Definition at line 1838 of file qgsgeometry.cpp.
bool QgsGeometry::touches  (  const QgsGeometry &  geometry  )  const 
Test for if geometry touch another (uses GEOS)
Definition at line 1016 of file qgsgeometry.cpp.
int QgsGeometry::transform  (  const QgsCoordinateTransform &  ct  ) 
Transform this geometry as described by CoordinateTransform ct.
Definition at line 2083 of file qgsgeometry.cpp.
int QgsGeometry::transform  (  const QTransform &  ct  ) 
Transform this geometry as described by QTransform ct.
Definition at line 2095 of file qgsgeometry.cpp.
int QgsGeometry::translate  (  double  dx, 
double  dy  
) 
Translate this geometry by dx, dy.
Definition at line 760 of file qgsgeometry.cpp.
QgsWkbTypes::GeometryType QgsGeometry::type  (  )  const 
Returns type of the geometry as a QgsWkbTypes::GeometryType.
Definition at line 288 of file qgsgeometry.cpp.

static 
Compute the unary union on a list of geometries.
May be faster than an iterative union on a set of geometries. The returned geometry will be fully noded, i.e. a node will be created at every common intersection of the input geometries. An empty geometry will be returned in the case of errors.
Definition at line 2025 of file qgsgeometry.cpp.
void QgsGeometry::validateGeometry  (  QList< QgsGeometry::Error > &  errors, 
ValidationMethod  method = ValidatorQgisInternal 

) 
Validate geometry and produce a list of geometry errors.
The method argument dictates which validator to utilize.
Definition at line 1989 of file qgsgeometry.cpp.
QgsPointXY QgsGeometry::vertexAt  (  int  atVertex  )  const 
Returns coordinates of a vertex.
atVertex  index of the vertex 
Definition at line 548 of file qgsgeometry.cpp.
bool QgsGeometry::vertexIdFromVertexNr  (  int  nr, 
QgsVertexId &  id  
)  const 
Calculates the vertex ID from a vertex number.
nr  vertex number 
id  reference to QgsVertexId for storing result 
Definition at line 2213 of file qgsgeometry.cpp.
int QgsGeometry::vertexNrFromVertexId  (  QgsVertexId  i  )  const 
Returns the vertex number corresponding to a vertex idd.
i  vertex id 
Definition at line 2249 of file qgsgeometry.cpp.
QgsGeometry QgsGeometry::voronoiDiagram  (  const QgsGeometry &  extent = QgsGeometry() , 
double  tolerance = 0.0 , 

bool  edgesOnly = false 

)  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 1636 of file qgsgeometry.cpp.
bool QgsGeometry::within  (  const QgsGeometry &  geometry  )  const 
Test for if geometry is within another (uses GEOS)
Definition at line 1038 of file qgsgeometry.cpp.
QgsWkbTypes::Type QgsGeometry::wkbType  (  )  const 
Returns type of the geometry as a WKB type (point / linestring / polygon etc.)
Definition at line 275 of file qgsgeometry.cpp.