Class: QgsAbstractGeometryTransformer

class qgis.core.QgsAbstractGeometryTransformer

Bases: sip.wrapper

An abstract base class for classes which transform geometries by transforming input points to output points.

Methods

transformPoint

Transforms the point defined by the coordinates (x, y, z) and the specified m value.

transformPoint(self, x: float, y: float, z: float, m: float) → Tuple[bool, float, float, float, float]

Transforms the point defined by the coordinates (x, y, z) and the specified m value.

Parameters
  • x (float) – point x coordinate

  • y (float) – point y coordinate

  • z (float) – point z coordinate, or NaN if the input point is 2D only

  • m (float) – point m value, or NaN if not available

Return type

Tuple[bool, float, float, float, float]

Returns

True if point was transformed (or no transformation was required), or False if point could not be transformed successfully.

A transformer which multiples the x coordinate by 3 and adds 10 to the y coordinate:

class MyTransformer(:py:class:`.QgsAbstractGeometryTransformer`):

  def transformPoint(self, x, y, z, m):
    # returns a tuple of True to indicate success, then the modified x/y/z/m values
    return True, x*3, y+10, z, m