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
Bases:
enum.IntEnum
Methods
Clones the transformer, returning a new copy of the transformer with the same parameters as this one.
Creates a new
QgsGcpTransformerInterface
subclass representing the specified transformmethod
.Creates a new
QgsGcpTransformerInterface
subclass representing the specified transformmethod
, initialized using the given lists of source and destination coordinates.Returns the transformation method.
Returns a translated string representing the specified transform
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.
- class TransformMethod(value)¶
Bases:
enum.IntEnum
Available 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 ¶
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:
- create(method: QgsGcpTransformerInterface.TransformMethod) QgsGcpTransformerInterface ¶
Creates a new
QgsGcpTransformerInterface
subclass representing the specified transformmethod
.Caller takes ownership of the returned object.
- Parameters:
method (QgsGcpTransformerInterface.TransformMethod) –
- Return type:
- createFromParameters(method: QgsGcpTransformerInterface.TransformMethod, sourceCoordinates: Iterable[QgsPointXY], destinationCoordinates: Iterable[QgsPointXY]) QgsGcpTransformerInterface ¶
Creates a new
QgsGcpTransformerInterface
subclass representing the specified transformmethod
, 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:
method (QgsGcpTransformerInterface.TransformMethod) –
sourceCoordinates (Iterable[QgsPointXY]) –
destinationCoordinates (Iterable[QgsPointXY]) –
- Return type:
- method(self) QgsGcpTransformerInterface.TransformMethod ¶
Returns the transformation method.
- Return type:
- 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
- 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 toTrue
, 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 toTrue
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) –