GDAL
|
Context for coordinate transformation. More...
#include <ogr_spatialref.h>
Public Member Functions | |
OGRCoordinateTransformationOptions () | |
Constructs a new OGRCoordinateTransformationOptions. | |
OGRCoordinateTransformationOptions (const OGRCoordinateTransformationOptions &) | |
Copy constructor. | |
OGRCoordinateTransformationOptions & | operator= (const OGRCoordinateTransformationOptions &) |
Assignment operator. | |
~OGRCoordinateTransformationOptions () | |
Destroys a OGRCoordinateTransformationOptions. | |
bool | SetAreaOfInterest (double dfWestLongitudeDeg, double dfSouthLatitudeDeg, double dfEastLongitudeDeg, double dfNorthLatitudeDeg) |
Sets an area of interest. | |
bool | SetDesiredAccuracy (double dfAccuracy) |
Sets the desired accuracy for coordinate operations. | |
bool | SetBallparkAllowed (bool bAllowBallpark) |
Sets whether ballpark transformations are allowed. | |
bool | SetOnlyBest (bool bOnlyBest) |
Sets whether only the "best" operation should be used. | |
bool | SetCoordinateOperation (const char *pszCT, bool bReverseCT) |
Sets a coordinate operation. | |
Context for coordinate transformation.
OGRCoordinateTransformationOptions::OGRCoordinateTransformationOptions | ( | ) |
Constructs a new OGRCoordinateTransformationOptions.
OGRCoordinateTransformationOptions::OGRCoordinateTransformationOptions | ( | const OGRCoordinateTransformationOptions & | other | ) |
Copy constructor.
OGRCoordinateTransformationOptions::~OGRCoordinateTransformationOptions | ( | ) |
Destroys a OGRCoordinateTransformationOptions.
OGRCoordinateTransformationOptions & OGRCoordinateTransformationOptions::operator= | ( | const OGRCoordinateTransformationOptions & | other | ) |
Assignment operator.
bool OGRCoordinateTransformationOptions::SetAreaOfInterest | ( | double | dfWestLongitudeDeg, |
double | dfSouthLatitudeDeg, | ||
double | dfEastLongitudeDeg, | ||
double | dfNorthLatitudeDeg | ||
) |
Sets an area of interest.
The west longitude is generally lower than the east longitude, except for areas of interest that go across the anti-meridian.
dfWestLongitudeDeg | West longitude (in degree). Must be in [-180,180] |
dfSouthLatitudeDeg | South latitude (in degree). Must be in [-90,90] |
dfEastLongitudeDeg | East longitude (in degree). Must be in [-180,180] |
dfNorthLatitudeDeg | North latitude (in degree). Must be in [-90,90] |
bool OGRCoordinateTransformationOptions::SetBallparkAllowed | ( | bool | bAllowBallpark | ) |
Sets whether ballpark transformations are allowed.
By default, PROJ may generate "ballpark transformations" (see https://proj.org/glossary.html) when precise datum transformations are missing. For high accuracy use cases, such transformations might not be allowed.
If this option is specified with PROJ < 8, the OGR_CT_OP_SELECTION configuration option will default to BEST_ACCURACY.
bAllowBallpark | false to disable the user of ballpark transformations |
bool OGRCoordinateTransformationOptions::SetCoordinateOperation | ( | const char * | pszCO, |
bool | bReverseCO | ||
) |
Sets a coordinate operation.
This is a user override to be used instead of the normally computed pipeline.
The pipeline must take into account the axis order of the source and target SRS.
The pipeline may be provided as a PROJ string (single step operation or multiple step string starting with +proj=pipeline), a WKT2 string describing a CoordinateOperation, or a "urn:ogc:def:coordinateOperation:EPSG::XXXX" URN
pszCO | PROJ or WKT string describing a coordinate operation |
bReverseCO | Whether the PROJ or WKT string should be evaluated in the reverse path |
bool OGRCoordinateTransformationOptions::SetDesiredAccuracy | ( | double | dfAccuracy | ) |
Sets the desired accuracy for coordinate operations.
Only coordinate operations that offer an accuracy of at least the one specified will be considered.
An accuracy of 0 is valid and means a coordinate operation made only of one or several conversions (map projections, unit conversion, etc.) Operations involving ballpark transformations have a unknown accuracy, and will be filtered out by any dfAccuracy >= 0 value.
If this option is specified with PROJ < 8, the OGR_CT_OP_SELECTION configuration option will default to BEST_ACCURACY.
dfAccuracy | accuracy in meters (or a negative value to disable this filter) |
bool OGRCoordinateTransformationOptions::SetOnlyBest | ( | bool | bOnlyBest | ) |
Sets whether only the "best" operation should be used.
By default (at least in the PROJ 9.x series), PROJ may use coordinate operations that are not the "best" if resources (typically grids) needed to use them are missing. It will then fallback to other coordinate operations that have a lesser accuracy, for example using Helmert transformations, or in the absence of such operations, to ones with potential very rought accuracy, using "ballpark" transformations (see https://proj.org/glossary.html).
When calling this method with bOnlyBest = true, PROJ will only consider the "best" operation, and error out (at Transform() time) if they cannot be used. This method may be used together with SetBallparkAllowed(false) to only allow best operations that have a known accuracy.
Note that this method has no effect on PROJ versions before 9.2.
The default value for this option can be also set with the PROJ_ONLY_BEST_DEFAULT environment variable, or with the "only_best_default" setting of proj.ini. Calling SetOnlyBest() overrides such default value.
bOnlyBest | set to true to ask PROJ to use only the best operation(s) |