Class: QgsGcpTransformerInterface

class qgis.analysis.QgsGcpTransformerInterface

Bases: sip.wrapper

An interface for Ground Control Points (GCP) based transformations.

QgsGcpTransformerInterface implementations are able to transform point locations based on a transformation method and a list of GCPs.

New in version 3.20.

QgsGcpTransformerInterface() Constructor for QgsGcpTransformerInterface

Enums

TransformMethod

Bases: enum.IntEnum

Methods

clone

Clones the transformer, returning a new copy of the transformer with the same parameters as this one.

create

Creates a new QgsGcpTransformerInterface subclass representing the specified transform method.

createFromParameters

Creates a new QgsGcpTransformerInterface subclass representing the specified transform method, initialized using the given lists of source and destination coordinates.

method

Returns the transformation method.

methodToString

Returns a translated string representing the specified transform method.

minimumGcpCount

Returns the minimum number of Ground Control Points (GCPs) required for parameter fitting.

transform

Transforms the point (x, y) from source to destination coordinates.

updateParametersFromGcps

Fits transformation parameters using the specified Ground Control Points (GCPs) lists of source and destination coordinates.

Attributes

staticMetaObject

class TransformMethod(value)

Bases: enum.IntEnum

Available transformation methods.

  • Linear: Linear transform

  • Helmert: Helmert transform

  • PolynomialOrder1: Polynomial order 1

  • PolynomialOrder2: Polyonmial order 2

  • PolynomialOrder3: Polynomial order

  • ThinPlateSpline: Thin plate splines

  • Projective: Projective

  • InvalidTransform: Invalid transform

Helmert = 1
InvalidTransform = 65535
Linear = 0
PolynomialOrder1 = 2
PolynomialOrder2 = 3
PolynomialOrder3 = 4
Projective = 6
ThinPlateSpline = 5
baseClass

alias of QgsGcpTransformerInterface

clone(self) QgsGcpTransformerInterface

Clones the transformer, returning a new copy of the transformer with the same parameters as this one.

Caller takes ownership of the returned object.

Return type:

QgsGcpTransformerInterface

create(method: QgsGcpTransformerInterface.TransformMethod) QgsGcpTransformerInterface

Creates a new QgsGcpTransformerInterface subclass representing the specified transform method.

Caller takes ownership of the returned object.

Parameters:

method (QgsGcpTransformerInterface.TransformMethod) –

Return type:

QgsGcpTransformerInterface

createFromParameters(method: QgsGcpTransformerInterface.TransformMethod, sourceCoordinates: Iterable[QgsPointXY], destinationCoordinates: Iterable[QgsPointXY]) QgsGcpTransformerInterface

Creates a new QgsGcpTransformerInterface subclass representing the specified transform method, initialized using the given lists of source and destination coordinates.

If the parameters cannot be fit to a transform None will be returned.

Caller takes ownership of the returned object.

Parameters:
Return type:

QgsGcpTransformerInterface

method(self) QgsGcpTransformerInterface.TransformMethod

Returns the transformation method.

Return type:

QgsGcpTransformerInterface.TransformMethod

methodToString(method: QgsGcpTransformerInterface.TransformMethod) str

Returns a translated string representing the specified transform method.

Parameters:

method (QgsGcpTransformerInterface.TransformMethod) –

Return type:

str

minimumGcpCount(self) int

Returns the minimum number of Ground Control Points (GCPs) required for parameter fitting.

Return type:

int

staticMetaObject = <PyQt5.QtCore.QMetaObject object>
transform(self, x: float, y: float, inverseTransform: bool = False) Tuple[bool, float, float]

Transforms the point (x, y) from source to destination coordinates.

If inverseTransform is set to True, the point will be transformed from the destination to the source.

Return type:

Tuple[bool, float, float]

Returns:

True if transformation was successful.

Parameters:
  • x (float) –

  • y (float) –

  • inverseTransform (bool = False) –

updateParametersFromGcps(self, sourceCoordinates: Iterable[QgsPointXY], destinationCoordinates: Iterable[QgsPointXY], invertYAxis: bool = False) bool

Fits transformation parameters using the specified Ground Control Points (GCPs) lists of source and destination coordinates.

If invertYAxis is set to True then the y-axis of source coordinates will be inverted, e.g. to allow for transformation of raster layers with ascending top-to-bottom vertical axis coordinates.

Return type:

bool

Returns:

True on success, False on failure

Parameters:
  • sourceCoordinates (Iterable[QgsPointXY]) –

  • destinationCoordinates (Iterable[QgsPointXY]) –

  • invertYAxis (bool = False) –