Class: QgsAbstractGeometryTransformer

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

Added in version 3.18.

Note

This is an abstract class, with methods which must be implemented by a subclass.

The following methods must be implemented: transformPoint()

Class Hierarchy

Inheritance diagram of qgis.core.QgsAbstractGeometryTransformer

Subclasses

QgsGcpGeometryTransformer

A geometry transformer which uses an underlying Ground Control Points (GCP) based transformation to modify geometries.

Abstract Methods

transformPoint

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

class qgis.core.QgsAbstractGeometryTransformer[source]

Bases: object

abstract transformPoint(self, x: float, y: float, z: float, m: float)[source]

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) -> (bool) – point m value, or NaN if not available

Returns:

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

Example

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

class MyTransformer(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