QGIS API Documentation 3.41.0-Master (45a0abf3bec)
|
Class for doing transforms between two map coordinate systems. More...
#include <qgscoordinatetransform.h>
Public Member Functions | |
QgsCoordinateTransform () | |
Default constructor, creates an invalid QgsCoordinateTransform. | |
QgsCoordinateTransform (const QgsCoordinateReferenceSystem &source, const QgsCoordinateReferenceSystem &destination, const QgsCoordinateTransformContext &context, Qgis::CoordinateTransformationFlags flags=Qgis::CoordinateTransformationFlags()) | |
Constructs a QgsCoordinateTransform to transform from the source to destination coordinate reference system. | |
QgsCoordinateTransform (const QgsCoordinateReferenceSystem &source, const QgsCoordinateReferenceSystem &destination, const QgsProject *project, Qgis::CoordinateTransformationFlags flags=Qgis::CoordinateTransformationFlags()) | |
Constructs a QgsCoordinateTransform to transform from the source to destination coordinate reference system, when used with the given project. | |
Q_DECL_DEPRECATED | QgsCoordinateTransform (const QgsCoordinateReferenceSystem &source, const QgsCoordinateReferenceSystem &destination, int sourceDatumTransformId, int destinationDatumTransformId) |
Constructs a QgsCoordinateTransform to transform from the source to destination coordinate reference system, with the specified datum transforms (see QgsDatumTransform). | |
QgsCoordinateTransform (const QgsCoordinateTransform &o) | |
~QgsCoordinateTransform () | |
bool | allowFallbackTransforms () const |
Returns whether "ballpark" fallback transformations will be used in the case that the specified coordinate operation fails (such as when coordinates from outside a required grid shift file are transformed). | |
QgsCoordinateTransformContext | context () const |
Returns the context in which the coordinate transform will be calculated. | |
QString | coordinateOperation () const |
Returns a Proj string representing the coordinate operation which will be used to transform coordinates. | |
QgsCoordinateReferenceSystem | destinationCrs () const |
Returns the destination coordinate reference system, which the transform will transform coordinates to. | |
Q_DECL_DEPRECATED int | destinationDatumTransformId () const |
Returns the ID of the datum transform to use when projecting to the destination CRS. | |
void | disableFallbackOperationHandler (bool disabled) |
Sets whether the default fallback operation handler is disabled for this transform instance. | |
bool | fallbackOperationOccurred () const |
Returns true if a fallback operation occurred for the most recent transform. | |
bool | hasVerticalComponent () const |
Returns true if the transform includes a vertical component, i.e. | |
QgsDatumTransform::TransformDetails | instantiatedCoordinateOperationDetails () const |
Returns the transform details representing the coordinate operation which is being used to transform coordinates. | |
bool | isShortCircuited () const |
Returns true if the transform short circuits because the source and destination are equivalent. | |
bool | isValid () const |
Returns true if the coordinate transform is valid, ie both the source and destination CRS have been set and are valid. | |
bool | operator!= (const QgsCoordinateTransform &other) const |
QgsCoordinateTransform & | operator= (const QgsCoordinateTransform &o) |
bool | operator== (const QgsCoordinateTransform &other) const |
double | scaleFactor (const QgsRectangle &referenceExtent) const |
Computes an estimated conversion factor between source and destination units: | |
void | setAllowFallbackTransforms (bool allowed) |
Sets whether "ballpark" fallback transformations can be used in the case that the specified coordinate operation fails (such as when coordinates from outside a required grid shift file are transformed). | |
void | setBallparkTransformsAreAppropriate (bool appropriate) |
Sets whether approximate "ballpark" results are appropriate for this coordinate transform. | |
void | setContext (const QgsCoordinateTransformContext &context) |
Sets the context in which the coordinate transform should be calculated. | |
void | setCoordinateOperation (const QString &operation) const |
Sets a Proj string representing the coordinate operation which will be used to transform coordinates. | |
void | setDestinationCrs (const QgsCoordinateReferenceSystem &crs) |
Sets the destination coordinate reference system. | |
Q_DECL_DEPRECATED void | setDestinationDatumTransformId (int datumId) |
Sets the datumId ID of the datum transform to use when projecting to the destination CRS. | |
void | setSourceCrs (const QgsCoordinateReferenceSystem &crs) |
Sets the source coordinate reference system. | |
Q_DECL_DEPRECATED void | setSourceDatumTransformId (int datumId) |
Sets the datumId ID of the datum transform to use when projecting from the source CRS. | |
QgsCoordinateReferenceSystem | sourceCrs () const |
Returns the source coordinate reference system, which the transform will transform coordinates from. | |
Q_DECL_DEPRECATED int | sourceDatumTransformId () const |
Returns the ID of the datum transform to use when projecting from the source CRS. | |
QgsPointXY | transform (const QgsPointXY &point, Qgis::TransformDirection direction=Qgis::TransformDirection::Forward) const |
Transform the point from the source CRS to the destination CRS. | |
QgsRectangle | transform (const QgsRectangle &rectangle, Qgis::TransformDirection direction=Qgis::TransformDirection::Forward) const |
Transforms a rectangle to the destination CRS. | |
QgsVector3D | transform (const QgsVector3D &point, Qgis::TransformDirection direction=Qgis::TransformDirection::Forward) const |
Transform the point specified in 3D coordinates from the source CRS to the destination CRS. | |
QgsPointXY | transform (double x, double y, Qgis::TransformDirection direction=Qgis::TransformDirection::Forward) const |
Transform the point specified by x,y from the source CRS to the destination CRS. | |
QgsRectangle | transformBoundingBox (const QgsRectangle &rectangle, Qgis::TransformDirection direction=Qgis::TransformDirection::Forward, bool handle180Crossover=false) const |
Transforms a rectangle from the source CRS to the destination CRS. | |
void | transformCoords (int numPoint, double *x, double *y, double *z, Qgis::TransformDirection direction=Qgis::TransformDirection::Forward) const |
Transform an array of coordinates to the destination CRS. | |
void | transformInPlace (double &x, double &y, double &z, Qgis::TransformDirection direction=Qgis::TransformDirection::Forward) const |
Transforms an array of x, y and z double coordinates in place, from the source CRS to the destination CRS. | |
void | transformInPlace (float &x, float &y, double &z, Qgis::TransformDirection direction=Qgis::TransformDirection::Forward) const |
Transforms an array of x, y and z float coordinates in place, from the source CRS to the destination CRS. | |
void | transformInPlace (float &x, float &y, float &z, Qgis::TransformDirection direction=Qgis::TransformDirection::Forward) const |
Transforms an array of x, y and z float coordinates in place, from the source CRS to the destination CRS. | |
void | transformInPlace (QVector< double > &x, QVector< double > &y, QVector< double > &z, Qgis::TransformDirection direction=Qgis::TransformDirection::Forward) const |
Transforms a vector of x, y and z double coordinates in place, from the source CRS to the destination CRS. | |
void | transformInPlace (QVector< float > &x, QVector< float > &y, QVector< float > &z, Qgis::TransformDirection direction=Qgis::TransformDirection::Forward) const |
Transforms a vector of x, y and z float coordinates in place, from the source CRS to the destination CRS. | |
void | transformPolygon (QPolygonF &polygon, Qgis::TransformDirection direction=Qgis::TransformDirection::Forward) const |
Transforms a polygon to the destination coordinate system. | |
Static Public Member Functions | |
static void | invalidateCache (bool disableCache=false) |
Clears the internal cache used to initialize QgsCoordinateTransform objects. | |
static bool | isTransformationPossible (const QgsCoordinateReferenceSystem &source, const QgsCoordinateReferenceSystem &destination) |
Returns true if it is theoretically possible to transform between source and destination CRSes. | |
static void | setCustomCoordinateOperationCreationErrorHandler (const std::function< void(const QgsCoordinateReferenceSystem &sourceCrs, const QgsCoordinateReferenceSystem &destinationCrs, const QString &error)> &handler) |
Sets a custom handler to use when a coordinate transform was required between sourceCrs and destinationCrs, yet the coordinate operation could not be created. | |
static void | setCustomMissingGridUsedByContextHandler (const std::function< void(const QgsCoordinateReferenceSystem &sourceCrs, const QgsCoordinateReferenceSystem &destinationCrs, const QgsDatumTransform::TransformDetails &desiredOperation)> &handler) |
Sets a custom handler to use when a coordinate operation was specified for use between sourceCrs and destinationCrs by the transform context, yet the coordinate operation could not be created. | |
static void | setCustomMissingPreferredGridHandler (const std::function< void(const QgsCoordinateReferenceSystem &sourceCrs, const QgsCoordinateReferenceSystem &destinationCrs, const QgsDatumTransform::TransformDetails &preferredOperation, const QgsDatumTransform::TransformDetails &availableOperation)> &handler) |
Sets a custom handler to use when a coordinate transform is created between sourceCrs and destinationCrs, yet a preferred (more accurate?) operation is available which could not be created on the system (e.g. | |
static void | setCustomMissingRequiredGridHandler (const std::function< void(const QgsCoordinateReferenceSystem &sourceCrs, const QgsCoordinateReferenceSystem &destinationCrs, const QgsDatumTransform::GridDetails &grid)> &handler) |
Sets a custom handler to use when a coordinate transform is created between sourceCrs and destinationCrs, yet the coordinate operation requires a transform grid which is not present on the system. | |
static void | setDynamicCrsToDynamicCrsWarningHandler (const std::function< void(const QgsCoordinateReferenceSystem &sourceCrs, const QgsCoordinateReferenceSystem &destinationCrs)> &handler) |
Sets a custom handler to use when the desired coordinate operation for use between sourceCrs and destinationCrs is a dynamic CRS to dynamic CRS transform, not currently supported by PROJ. | |
static void | setFallbackOperationOccurredHandler (const std::function< void(const QgsCoordinateReferenceSystem &sourceCrs, const QgsCoordinateReferenceSystem &destinationCrs, const QString &desiredOperation)> &handler) |
Sets a custom handler to use when the desired coordinate operation for use between sourceCrs and destinationCrs failed and an alternative fallback operation was utilized instead. | |
Friends | |
class | QgsProjContext |
class | TestQgsCoordinateTransform |
Class for doing transforms between two map coordinate systems.
This class can convert map coordinates to a different coordinate reference system. It is normally associated with a map layer and is used to transform between the layer's coordinate system and the coordinate system of the map canvas, although it can be used in a more general sense to transform coordinates.
When used to transform between a layer and the map canvas, all references to source and destination coordinate systems refer to layer and map canvas respectively. All operations are from the perspective of the layer. For example, a forward transformation transforms coordinates from the layer's coordinate system to the map canvas.
Definition at line 57 of file qgscoordinatetransform.h.
QgsCoordinateTransform::QgsCoordinateTransform | ( | ) |
Default constructor, creates an invalid QgsCoordinateTransform.
Definition at line 57 of file qgscoordinatetransform.cpp.
|
explicit |
Constructs a QgsCoordinateTransform to transform from the source to destination coordinate reference system.
The context argument specifies the context under which the transform will be applied, and is used for calculating necessary datum transforms to utilize.
Python scripts should generally use the constructor variant which accepts a QgsProject instance instead of this constructor.
Since QGIS 3.26 the optional flags argument can be used to specify flags which dictate the behavior of the transformation.
Definition at line 62 of file qgscoordinatetransform.cpp.
|
explicit |
Constructs a QgsCoordinateTransform to transform from the source to destination coordinate reference system, when used with the given project.
No reference to project is stored or utilized outside of the constructor, and it is used to retrieve the project's transform context only.
Python scripts should utilize the QgsProject.instance() project instance when creating QgsCoordinateTransform. This will ensure that any datum transforms defined in the project will be correctly respected during coordinate transforms. E.g.
Since QGIS 3.26 the optional flags argument can be used to specify flags which dictate the behavior of the transformation.
Definition at line 95 of file qgscoordinatetransform.cpp.
|
explicit |
Constructs a QgsCoordinateTransform to transform from the source to destination coordinate reference system, with the specified datum transforms (see QgsDatumTransform).
Definition at line 128 of file qgscoordinatetransform.cpp.
QgsCoordinateTransform::QgsCoordinateTransform | ( | const QgsCoordinateTransform & | o | ) |
Definition at line 147 of file qgscoordinatetransform.cpp.
QgsCoordinateTransform::~QgsCoordinateTransform | ( | ) |
Definition at line 175 of file qgscoordinatetransform.cpp.
bool QgsCoordinateTransform::allowFallbackTransforms | ( | ) | const |
Returns whether "ballpark" fallback transformations will be used in the case that the specified coordinate operation fails (such as when coordinates from outside a required grid shift file are transformed).
See fallbackOperationOccurred() for further details.
Definition at line 965 of file qgscoordinatetransform.cpp.
QgsCoordinateTransformContext QgsCoordinateTransform::context | ( | ) | const |
Returns the context in which the coordinate transform will be calculated.
Definition at line 278 of file qgscoordinatetransform.cpp.
QString QgsCoordinateTransform::coordinateOperation | ( | ) | const |
Returns a Proj string representing the coordinate operation which will be used to transform coordinates.
Definition at line 941 of file qgscoordinatetransform.cpp.
QgsCoordinateReferenceSystem QgsCoordinateTransform::destinationCrs | ( | ) | const |
Returns the destination coordinate reference system, which the transform will transform coordinates to.
Definition at line 288 of file qgscoordinatetransform.cpp.
int QgsCoordinateTransform::destinationDatumTransformId | ( | ) | const |
Returns the ID of the datum transform to use when projecting to the destination CRS.
This is usually calculated automatically from the transform's QgsCoordinateTransformContext, but can be manually overwritten by a call to setDestinationDatumTransformId().
Definition at line 1077 of file qgscoordinatetransform.cpp.
void QgsCoordinateTransform::disableFallbackOperationHandler | ( | bool | disabled | ) |
Sets whether the default fallback operation handler is disabled for this transform instance.
If the default handler is disabled then it is possible to determine whether a fallback operation occurred by testing fallbackOperationOccurred() immediately after a transformation.
Definition at line 975 of file qgscoordinatetransform.cpp.
bool QgsCoordinateTransform::fallbackOperationOccurred | ( | ) | const |
Returns true
if a fallback operation occurred for the most recent transform.
Definition at line 980 of file qgscoordinatetransform.cpp.
bool QgsCoordinateTransform::hasVerticalComponent | ( | ) | const |
Returns true
if the transform includes a vertical component, i.e.
if both the sourceCrs() and destinationCrs() have a vertical axis.
Definition at line 936 of file qgscoordinatetransform.cpp.
QgsDatumTransform::TransformDetails QgsCoordinateTransform::instantiatedCoordinateOperationDetails | ( | ) | const |
Returns the transform details representing the coordinate operation which is being used to transform coordinates.
This may differ from the result returned by coordinateOperation() if the desired coordinate operation was not successfully instantiated.
Definition at line 946 of file qgscoordinatetransform.cpp.
|
static |
Clears the internal cache used to initialize QgsCoordinateTransform objects.
This should be called whenever the srs database has been modified in order to ensure that outdated CRS transforms are not created.
If disableCache is true
then the inbuilt cache will be completely disabled. This argument is for internal use only.
Definition at line 1092 of file qgscoordinatetransform.cpp.
bool QgsCoordinateTransform::isShortCircuited | ( | ) | const |
Returns true
if the transform short circuits because the source and destination are equivalent.
Definition at line 931 of file qgscoordinatetransform.cpp.
|
static |
Returns true
if it is theoretically possible to transform between source and destination CRSes.
For example, will return false
if source and destination relate to different celestial bodies and a transformation between them will never be possible.
true
, yet construction of a matching QgsCoordinateTransform fails (e.g. due to missing grid shift files on the system).Definition at line 191 of file qgscoordinatetransform.cpp.
bool QgsCoordinateTransform::isValid | ( | ) | const |
Returns true
if the coordinate transform is valid, ie both the source and destination CRS have been set and are valid.
Definition at line 926 of file qgscoordinatetransform.cpp.
bool QgsCoordinateTransform::operator!= | ( | const QgsCoordinateTransform & | other | ) | const |
Definition at line 186 of file qgscoordinatetransform.cpp.
QgsCoordinateTransform & QgsCoordinateTransform::operator= | ( | const QgsCoordinateTransform & | o | ) |
Definition at line 164 of file qgscoordinatetransform.cpp.
bool QgsCoordinateTransform::operator== | ( | const QgsCoordinateTransform & | other | ) | const |
Definition at line 177 of file qgscoordinatetransform.cpp.
double QgsCoordinateTransform::scaleFactor | ( | const QgsRectangle & | referenceExtent | ) | const |
Computes an estimated conversion factor between source and destination units:
sourceUnits * scaleFactor = destinationUnits
referenceExtent | A reference extent based on which to perform the computation |
Definition at line 1130 of file qgscoordinatetransform.cpp.
void QgsCoordinateTransform::setAllowFallbackTransforms | ( | bool | allowed | ) |
Sets whether "ballpark" fallback transformations can be used in the case that the specified coordinate operation fails (such as when coordinates from outside a required grid shift file are transformed).
See fallbackOperationOccurred() for further details.
true
, this setting will be ignored and fallback transformations will always be permitted.Definition at line 959 of file qgscoordinatetransform.cpp.
void QgsCoordinateTransform::setBallparkTransformsAreAppropriate | ( | bool | appropriate | ) |
Sets whether approximate "ballpark" results are appropriate for this coordinate transform.
When a coordinate transform is only being used to generate ballpark results then the appropriate argument should be set to true
. This indicates that its perfectable acceptable (and even expected!) for the transform to use fallback coordinate operations in the case that the preferred or user-specified operation fails (such as when coordinates from outside of a grid shift file's extent are transformed).
When appropriate is true
, then no warnings will be generated when the transform falls back to a default operation, which may introduce inaccuracies when compared to the default/specified coordinate operation.
This should be set when a transform expects that coordinates outside of the direct area of use while be transformed, e.g. when transforming from a global extent to a CRS with a localized area of use.
If appropriate is false
(the default behavior), then transforms MAY STILL fallback to default operations when the preferred or user-specified operation fails, however whenever this occurs a user-visible warning will be generated.
If appropriate is true
, then this setting overrides allowFallbackTransforms() and fallback transforms will always be allowed when required.
Definition at line 970 of file qgscoordinatetransform.cpp.
void QgsCoordinateTransform::setContext | ( | const QgsCoordinateTransformContext & | context | ) |
Sets the context in which the coordinate transform should be calculated.
Definition at line 251 of file qgscoordinatetransform.cpp.
void QgsCoordinateTransform::setCoordinateOperation | ( | const QString & | operation | ) | const |
Sets a Proj string representing the coordinate operation which will be used to transform coordinates.
Definition at line 952 of file qgscoordinatetransform.cpp.
|
static |
Sets a custom handler to use when a coordinate transform was required between sourceCrs and destinationCrs, yet the coordinate operation could not be created.
The error argument specifies the error message obtained.
Definition at line 1151 of file qgscoordinatetransform.cpp.
|
static |
Sets a custom handler to use when a coordinate operation was specified for use between sourceCrs and destinationCrs by the transform context, yet the coordinate operation could not be created.
The desiredOperation argument specifies the desired transform details as specified by the context.
Definition at line 1156 of file qgscoordinatetransform.cpp.
|
static |
Sets a custom handler to use when a coordinate transform is created between sourceCrs and destinationCrs, yet a preferred (more accurate?) operation is available which could not be created on the system (e.g.
due to missing transform grids).
preferredOperation gives the details of the preferred coordinate operation, and availableOperation gives the details of the actual operation to be used during the transform.
Definition at line 1146 of file qgscoordinatetransform.cpp.
|
static |
Sets a custom handler to use when a coordinate transform is created between sourceCrs and destinationCrs, yet the coordinate operation requires a transform grid which is not present on the system.
Definition at line 1141 of file qgscoordinatetransform.cpp.
void QgsCoordinateTransform::setDestinationCrs | ( | const QgsCoordinateReferenceSystem & | crs | ) |
Sets the destination coordinate reference system.
crs | CRS to transform coordinates to |
Definition at line 227 of file qgscoordinatetransform.cpp.
void QgsCoordinateTransform::setDestinationDatumTransformId | ( | int | datumId | ) |
Sets the datumId ID of the datum transform to use when projecting to the destination CRS.
This is usually calculated automatically from the transform's QgsCoordinateTransformContext. Calling this method will overwrite any automatically calculated datum transform.
Definition at line 1084 of file qgscoordinatetransform.cpp.
|
static |
Sets a custom handler to use when the desired coordinate operation for use between sourceCrs and destinationCrs is a dynamic CRS to dynamic CRS transform, not currently supported by PROJ.
Definition at line 1166 of file qgscoordinatetransform.cpp.
|
static |
Sets a custom handler to use when the desired coordinate operation for use between sourceCrs and destinationCrs failed and an alternative fallback operation was utilized instead.
Definition at line 1161 of file qgscoordinatetransform.cpp.
void QgsCoordinateTransform::setSourceCrs | ( | const QgsCoordinateReferenceSystem & | crs | ) |
Sets the source coordinate reference system.
crs | CRS to transform coordinates from |
Definition at line 204 of file qgscoordinatetransform.cpp.
void QgsCoordinateTransform::setSourceDatumTransformId | ( | int | datumId | ) |
Sets the datumId ID of the datum transform to use when projecting from the source CRS.
This is usually calculated automatically from the transform's QgsCoordinateTransformContext. Calling this method will overwrite any automatically calculated datum transform.
Definition at line 1069 of file qgscoordinatetransform.cpp.
QgsCoordinateReferenceSystem QgsCoordinateTransform::sourceCrs | ( | ) | const |
Returns the source coordinate reference system, which the transform will transform coordinates from.
Definition at line 283 of file qgscoordinatetransform.cpp.
int QgsCoordinateTransform::sourceDatumTransformId | ( | ) | const |
Returns the ID of the datum transform to use when projecting from the source CRS.
This is usually calculated automatically from the transform's QgsCoordinateTransformContext, but can be manually overwritten by a call to setSourceDatumTransformId().
Definition at line 1062 of file qgscoordinatetransform.cpp.
QgsPointXY QgsCoordinateTransform::transform | ( | const QgsPointXY & | point, |
Qgis::TransformDirection | direction = Qgis::TransformDirection::Forward |
||
) | const |
Transform the point from the source CRS to the destination CRS.
If the direction is ForwardTransform then coordinates are transformed from source to destination, otherwise points are transformed from destination to source CRS.
point | point to transform |
direction | transform direction (defaults to ForwardTransform) |
QgsCsException | if the transformation fails |
Definition at line 293 of file qgscoordinatetransform.cpp.
QgsRectangle QgsCoordinateTransform::transform | ( | const QgsRectangle & | rectangle, |
Qgis::TransformDirection | direction = Qgis::TransformDirection::Forward |
||
) | const |
Transforms a rectangle to the destination CRS.
If the direction is ForwardTransform then coordinates are transformed from source to destination, otherwise points are transformed from destination to source CRS.
rectangle | rectangle to transform |
direction | transform direction (defaults to ForwardTransform) |
QgsCsException | if the transformation fails |
Definition at line 331 of file qgscoordinatetransform.cpp.
QgsVector3D QgsCoordinateTransform::transform | ( | const QgsVector3D & | point, |
Qgis::TransformDirection | direction = Qgis::TransformDirection::Forward |
||
) | const |
Transform the point specified in 3D coordinates from the source CRS to the destination CRS.
If the direction is ForwardTransform then coordinates are transformed from source to destination, otherwise points are transformed from destination to source CRS.
point | coordinates of point to transform |
direction | transform direction (defaults to ForwardTransform) |
QgsCsException | if the transformation fails |
Definition at line 367 of file qgscoordinatetransform.cpp.
QgsPointXY QgsCoordinateTransform::transform | ( | double | x, |
double | y = 0.0 , |
||
Qgis::TransformDirection | direction = Qgis::TransformDirection::Forward |
||
) | const |
Transform the point specified by x,y from the source CRS to the destination CRS.
If the direction is ForwardTransform then coordinates are transformed from source to destination, otherwise points are transformed from destination to source CRS.
x | x coordinate of point to transform |
y | y coordinate of point to transform |
direction | transform direction (defaults to ForwardTransform) |
QgsCsException | if the transformation fails |
Definition at line 317 of file qgscoordinatetransform.cpp.
QgsRectangle QgsCoordinateTransform::transformBoundingBox | ( | const QgsRectangle & | rectangle, |
Qgis::TransformDirection | direction = Qgis::TransformDirection::Forward , |
||
bool | handle180Crossover = false |
||
) | const |
Transforms a rectangle from the source CRS to the destination CRS.
If the direction is ForwardTransform then coordinates are transformed from source to destination, otherwise points are transformed from destination to source CRS. This method assumes that the rectangle is a bounding box, and creates a bounding box in the projected CRS, such that all points from the source rectangle are within the returned rectangle.
rectangle | rectangle to transform |
direction | transform direction (defaults to ForwardTransform) |
handle180Crossover | set to true if destination CRS is geographic and handling of extents crossing the 180 degree longitude line is required |
QgsCsException | if the transformation fails |
Definition at line 581 of file qgscoordinatetransform.cpp.
void QgsCoordinateTransform::transformCoords | ( | int | numPoint, |
double * | x, | ||
double * | y, | ||
double * | z, | ||
Qgis::TransformDirection | direction = Qgis::TransformDirection::Forward |
||
) | const |
Transform an array of coordinates to the destination CRS.
If the direction is ForwardTransform then coordinates are transformed from source to destination, otherwise points are transformed from destination to source CRS.
numPoint | number of coordinates in arrays |
x | array of x coordinates to transform |
y | array of y coordinates to transform |
z | array of z coordinates to transform |
direction | transform direction (defaults to ForwardTransform) |
QgsCsException | if the transformation fails |
Definition at line 738 of file qgscoordinatetransform.cpp.
void QgsCoordinateTransform::transformInPlace | ( | double & | x, |
double & | y, | ||
double & | z, | ||
Qgis::TransformDirection | direction = Qgis::TransformDirection::Forward |
||
) | const |
Transforms an array of x, y and z double coordinates in place, from the source CRS to the destination CRS.
If the direction is ForwardTransform then coordinates are transformed from source to destination, otherwise points are transformed from destination to source CRS.
x | array of x coordinates of points to transform |
y | array of y coordinates of points to transform |
z | array of z coordinates of points to transform. The z coordinates of the points must represent height relative to the vertical datum of the source CRS (generally ellipsoidal heights) and must be expressed in its vertical units (generally meters) |
direction | transform direction (defaults to ForwardTransform) |
QgsCsException | if the transformation fails |
Definition at line 385 of file qgscoordinatetransform.cpp.
void QgsCoordinateTransform::transformInPlace | ( | float & | x, |
float & | y, | ||
double & | z, | ||
Qgis::TransformDirection | direction = Qgis::TransformDirection::Forward |
||
) | const |
Transforms an array of x, y and z float coordinates in place, from the source CRS to the destination CRS.
If the direction is ForwardTransform then coordinates are transformed from source to destination, otherwise points are transformed from destination to source CRS.
x | array of x coordinates of points to transform |
y | array of y coordinates of points to transform |
z | array of z coordinates of points to transform. The z coordinates of the points must represent height relative to the vertical datum of the source CRS (generally ellipsoidal heights) and must be expressed in its vertical units (generally meters) |
direction | transform direction (defaults to ForwardTransform) |
QgsCsException | if the transformation fails |
Definition at line 406 of file qgscoordinatetransform.cpp.
void QgsCoordinateTransform::transformInPlace | ( | float & | x, |
float & | y, | ||
float & | z, | ||
Qgis::TransformDirection | direction = Qgis::TransformDirection::Forward |
||
) | const |
Transforms an array of x, y and z float coordinates in place, from the source CRS to the destination CRS.
If the direction is ForwardTransform then coordinates are transformed from source to destination, otherwise points are transformed from destination to source CRS.
x | array of x coordinates of points to transform |
y | array of y coordinates of points to transform |
z | array of z coordinates of points to transform. The z coordinates of the points must represent height relative to the vertical datum of the source CRS (generally ellipsoidal heights) and must be expressed in its vertical units (generally meters) |
direction | transform direction (defaults to ForwardTransform) |
QgsCsException | if the transformation fails |
Definition at line 415 of file qgscoordinatetransform.cpp.
void QgsCoordinateTransform::transformInPlace | ( | QVector< double > & | x, |
QVector< double > & | y, | ||
QVector< double > & | z, | ||
Qgis::TransformDirection | direction = Qgis::TransformDirection::Forward |
||
) | const |
Transforms a vector of x, y and z double coordinates in place, from the source CRS to the destination CRS.
If the direction is ForwardTransform then coordinates are transformed from source to destination, otherwise points are transformed from destination to source CRS.
x | vector of x coordinates of points to transform |
y | vector of y coordinates of points to transform |
z | vector of z coordinates of points to transform. The z coordinates of the points must represent height relative to the vertical datum of the source CRS (generally ellipsoidal heights) and must be expressed in its vertical units (generally meters) |
direction | transform direction (defaults to ForwardTransform) |
QgsCsException | if the transformation fails |
Definition at line 494 of file qgscoordinatetransform.cpp.
void QgsCoordinateTransform::transformInPlace | ( | QVector< float > & | x, |
QVector< float > & | y, | ||
QVector< float > & | z, | ||
Qgis::TransformDirection | direction = Qgis::TransformDirection::Forward |
||
) | const |
Transforms a vector of x, y and z float coordinates in place, from the source CRS to the destination CRS.
If the direction is ForwardTransform then coordinates are transformed from source to destination, otherwise points are transformed from destination to source CRS.
x | vector of x coordinates of points to transform |
y | vector of y coordinates of points to transform |
z | vector of z coordinates of points to transform. The z coordinates of the points must represent height relative to the vertical datum of the source CRS (generally ellipsoidal heights) and must be expressed in its vertical units (generally meters) |
direction | transform direction (defaults to ForwardTransform) |
QgsCsException | if the transformation fails |
Definition at line 521 of file qgscoordinatetransform.cpp.
void QgsCoordinateTransform::transformPolygon | ( | QPolygonF & | polygon, |
Qgis::TransformDirection | direction = Qgis::TransformDirection::Forward |
||
) | const |
Transforms a polygon to the destination coordinate system.
polygon | polygon to transform (occurs in place) |
direction | transform direction (defaults to forward transformation) |
QgsCsException | if the transformation fails |
Definition at line 442 of file qgscoordinatetransform.cpp.
|
friend |
Definition at line 720 of file qgscoordinatetransform.h.
|
friend |
Definition at line 765 of file qgscoordinatetransform.h.