Class: QgsGcpTransformerInterface¶
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.
Added in version 3.20.
Enums
Available transformation methods. |
Methods
Clones the transformer, returning a new copy of the transformer with the same parameters as this one. |
|
Returns the transformation method. |
|
Returns the minimum number of Ground Control Points (GCPs) required for parameter fitting. |
|
Transforms the point (x, y) from source to destination coordinates. |
|
Fits transformation parameters using the specified Ground Control Points (GCPs) lists of source and destination coordinates. |
Static Methods
Creates a new |
|
Creates a new |
|
Returns a translated string representing the specified transform method. |
- class qgis.analysis.QgsGcpTransformerInterface[source]¶
Bases:
object- class TransformMethod(*values)¶
Bases:
IntEnumAvailable transformation methods.
Linear: Linear transformHelmert: Helmert transformPolynomialOrder1: Polynomial order 1PolynomialOrder2: Polyonmial order 2PolynomialOrder3: Polynomial orderThinPlateSpline: Thin plate splinesProjective: ProjectiveInvalidTransform: Invalid transform
- Helmert = 1¶
- InvalidTransform = 65535¶
- Linear = 0¶
- PolynomialOrder1 = 2¶
- PolynomialOrder2 = 3¶
- PolynomialOrder3 = 4¶
- Projective = 6¶
- ThinPlateSpline = 5¶
- clone(self) QgsGcpTransformerInterface | None[source]¶
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:
Optional[QgsGcpTransformerInterface]
- static create(method: QgsGcpTransformerInterface.TransformMethod) QgsGcpTransformerInterface | None[source]¶
Creates a new
QgsGcpTransformerInterfacesubclass representing the specified transformmethod.Caller takes ownership of the returned object.
- Parameters:
- Return type:
Optional[QgsGcpTransformerInterface]
- static createFromParameters(method: QgsGcpTransformerInterface.TransformMethod, sourceCoordinates: Iterable[QgsPointXY], destinationCoordinates: Iterable[QgsPointXY]) QgsGcpTransformerInterface | None[source]¶
Creates a new
QgsGcpTransformerInterfacesubclass representing the specified transformmethod, initialized using the given lists of source and destination coordinates.If the parameters cannot be fit to a transform
Nonewill be returned.Caller takes ownership of the returned object.
- Parameters:
sourceCoordinates (Iterable[QgsPointXY])
destinationCoordinates (Iterable[QgsPointXY])
- Return type:
Optional[QgsGcpTransformerInterface]
- method(self) QgsGcpTransformerInterface.TransformMethod[source]¶
Returns the transformation method.
- Return type:
- static methodToString(method: QgsGcpTransformerInterface.TransformMethod) str[source]¶
Returns a translated string representing the specified transform
method.- Parameters:
- Return type:
str
- minimumGcpCount(self) int[source]¶
Returns the minimum number of Ground Control Points (GCPs) required for parameter fitting.
- Return type:
int
- transform(self, x: float, y: float, inverseTransform: bool = False)[source]¶
Transforms the point (
x,y) from source to destination coordinates.If
inverseTransformis set toTrue, the point will be transformed from the destination to the source.- Returns:
Trueif transformation was successful.- Parameters:
x (float)
y (float)
inverseTransform (bool = False) -> (bool)
- updateParametersFromGcps(self, sourceCoordinates: Iterable[QgsPointXY], destinationCoordinates: Iterable[QgsPointXY], invertYAxis: bool = False) bool[source]¶
Fits transformation parameters using the specified Ground Control Points (GCPs) lists of source and destination coordinates.
If
invertYAxisis set toTruethen 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:
Trueon success,Falseon failure- Parameters:
sourceCoordinates (Iterable[QgsPointXY])
destinationCoordinates (Iterable[QgsPointXY])
invertYAxis (bool = False)