Class: QgsGeometryEngine

class qgis.core.QgsGeometryEngine

Bases: sip.wrapper

Contains geometry relation and modification algorithms.

New in version 2.10: Methods

area
buffer buffer(self, distance: float, segments: int, endCapStyle: int, joinStyle: int, miterLimit: float, errorMsg: str = ‘’) -> QgsAbstractGeometry
centroid Calculates the centroid of this.
combine Calculate the combination of this and geom.
contains Checks if geom contains this.
convexHull Calculate the convex hull of this.
crosses Checks if geom crosses this.
difference Calculate the difference of this and geom.
disjoint Checks if geom is disjoint from this.
distance Calculates the distance between this and geom.
envelope
geometryChanged Should be called whenever the geometry associated with the engine has been modified and the engine must be updated to suit.
interpolate
intersection Calculate the intersection of this and geom.
intersects Checks if geom intersects this.
isEmpty
isEqual Checks if this is equal to geom.
isSimple Determines whether the geometry is simple (according to OGC definition).
isValid
length
offsetCurve
overlaps Checks if geom overlaps this.
pointOnSurface Calculate a point that is guaranteed to be on the surface of this.
prepareGeometry Prepares the geometry, so that subsequent calls to spatial relation methods are much faster.
relate Returns the Dimensional Extended 9 Intersection Model (DE-9IM) representation of the relationship between the geometries.
relatePattern Tests whether two geometries are related by a specified Dimensional Extended 9 Intersection Model (DE-9IM) pattern.
simplify
splitGeometry Splits this geometry according to a given line.
symDifference Calculate the symmetric difference of this and geom.
touches Checks if geom touches this.
within Checks if geom is within this.

Signals

Attributes

EngineError
InvalidBaseGeometry
InvalidInput
MethodNotImplemented
NodedGeometryError
NothingHappened
SplitCannotSplitPoint
Success
EngineError = 1002
class EngineOperationResult

Bases: int

InvalidBaseGeometry = 1004
InvalidInput = 1005
MethodNotImplemented = 1001
NodedGeometryError = 1003
NothingHappened = 1000
SplitCannotSplitPoint = 1006
Success = 0
area(self, errorMsg: str = '') → float
buffer(self, distance: float, segments: int, errorMsg: str = '') → QgsAbstractGeometry

buffer(self, distance: float, segments: int, endCapStyle: int, joinStyle: int, miterLimit: float, errorMsg: str = ‘’) -> QgsAbstractGeometry

centroid(self, errorMsg: str = '') → QgsPoint

Calculates the centroid of this. May return a None.

New in version 3.0.

combine(self, geom: QgsAbstractGeometry, errorMsg: str = '') → QgsAbstractGeometry

Calculate the combination of this and geom.

New in version 3.0.

combine(self, geomList: object, errorMsg: str) -> QgsAbstractGeometry Calculate the combination of this and geometries.

New in version 3.0.

combine(self, geometries: object, errorMsg: str = ‘’) -> QgsAbstractGeometry Calculate the combination of this and geometries.

New in version 3.0.

contains(self, geom: QgsAbstractGeometry, errorMsg: str = '') → bool

Checks if geom contains this.

New in version 3.0.

convexHull(self, errorMsg: str = '') → QgsAbstractGeometry

Calculate the convex hull of this.

crosses(self, geom: QgsAbstractGeometry, errorMsg: str = '') → bool

Checks if geom crosses this.

New in version 3.0.

difference(self, geom: QgsAbstractGeometry, errorMsg: str = '') → QgsAbstractGeometry

Calculate the difference of this and geom.

New in version 3.0.

disjoint(self, geom: QgsAbstractGeometry, errorMsg: str = '') → bool

Checks if geom is disjoint from this.

New in version 3.0.

distance(self, geom: QgsAbstractGeometry, errorMsg: str = '') → float

Calculates the distance between this and geom.

New in version 3.0.

envelope(self, errorMsg: str = '') → QgsAbstractGeometry
geometryChanged(self)

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

interpolate(self, distance: float, errorMsg: str = '') → QgsAbstractGeometry
intersection(self, geom: QgsAbstractGeometry, errorMsg: str = '') → QgsAbstractGeometry

Calculate the intersection of this and geom.

New in version 3.0.

intersects(self, geom: QgsAbstractGeometry, errorMsg: str = '') → bool

Checks if geom intersects this.

New in version 3.0.

isEmpty(self, errorMsg: str) → bool
isEqual(self, geom: QgsAbstractGeometry, errorMsg: str = '') → bool

Checks if this is equal to geom. If both are Null geometries, false is returned.

New in version 3.0.

isSimple(self, errorMsg: str = '') → bool

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

New in version 3.0.

isValid(self, errorMsg: str = '') → bool
length(self, errorMsg: str = '') → float
offsetCurve(self, distance: float, segments: int, joinStyle: int, miterLimit: float, errorMsg: str = '') → QgsAbstractGeometry
overlaps(self, geom: QgsAbstractGeometry, errorMsg: str = '') → bool

Checks if geom overlaps this.

New in version 3.0.

pointOnSurface(self, errorMsg: str = '') → QgsPoint

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

New in version 3.0.

prepareGeometry(self)

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.

relate(self, geom: QgsAbstractGeometry, errorMsg: str = '') → str

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

Parameters:
  • geom – geometry to relate to
  • errorMsg – destination storage for any error message
Returns:

DE-9IM string for relationship, or an empty string if an error occurred

New in version 2.12.

relatePattern(self, geom: QgsAbstractGeometry, pattern: str, errorMsg: str = '') → bool

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

Parameters:
  • geom – geometry to relate to
  • pattern – DE-9IM pattern for match
  • errorMsg – destination storage for any error message
Returns:

true if geometry relationship matches with pattern

New in version 2.14.

simplify(self, tolerance: float, errorMsg: str = '') → QgsAbstractGeometry
splitGeometry(self, splitLine: QgsLineString, topological: bool, topologyTestPoints: object, errorMsg: str = '') → Tuple[QgsGeometryEngine.EngineOperationResult, List[QgsGeometry]]

Splits this geometry according to a given line.

Parameters:splitLine – the line that splits the geometry

param[out] newGeometries list of new geometries that have been created with the split :param topological: true if topological editing is enabled param[out] topologyTestPoints points that need to be tested for topological completeness in the dataset param[out] errorMsg error messages emitted, if any

Returns:0 in case of success, 1 if geometry has not been split, error else
symDifference(self, geom: QgsAbstractGeometry, errorMsg: str = '') → QgsAbstractGeometry

Calculate the symmetric difference of this and geom.

New in version 3.0.

touches(self, geom: QgsAbstractGeometry, errorMsg: str = '') → bool

Checks if geom touches this.

New in version 3.0.

within(self, geom: QgsAbstractGeometry, errorMsg: str = '') → bool

Checks if geom is within this.

New in version 3.0.