GDAL
Public Member Functions | List of all members
OGRCoordinateTransformationOptions Struct Reference

Context for coordinate transformation. More...

#include <ogr_spatialref.h>

Public Member Functions

 OGRCoordinateTransformationOptions ()
 Constructs a new OGRCoordinateTransformationOptions. More...
 
 OGRCoordinateTransformationOptions (const OGRCoordinateTransformationOptions &)
 Copy constructor. More...
 
OGRCoordinateTransformationOptionsoperator= (const OGRCoordinateTransformationOptions &)
 Assignment operator. More...
 
 ~OGRCoordinateTransformationOptions ()
 Destroys a OGRCoordinateTransformationOptions. More...
 
bool SetAreaOfInterest (double dfWestLongitudeDeg, double dfSouthLatitudeDeg, double dfEastLongitudeDeg, double dfNorthLatitudeDeg)
 Sets an area of interest. More...
 
bool SetDesiredAccuracy (double dfAccuracy)
 Sets the desired accuracy for coordinate operations. More...
 
bool SetBallparkAllowed (bool bAllowBallpark)
 Sets whether ballpark transformations are allowed. More...
 
bool SetOnlyBest (bool bOnlyBest)
 Sets whether only the "best" operation should be used. More...
 
bool SetCoordinateOperation (const char *pszCT, bool bReverseCT)
 Sets a coordinate operation. More...
 

Detailed Description

Context for coordinate transformation.

Since
GDAL 3.0

Constructor & Destructor Documentation

◆ OGRCoordinateTransformationOptions() [1/2]

OGRCoordinateTransformationOptions::OGRCoordinateTransformationOptions ( )

Constructs a new OGRCoordinateTransformationOptions.

Since
GDAL 3.0

◆ OGRCoordinateTransformationOptions() [2/2]

OGRCoordinateTransformationOptions::OGRCoordinateTransformationOptions ( const OGRCoordinateTransformationOptions other)

Copy constructor.

Since
GDAL 3.1

◆ ~OGRCoordinateTransformationOptions()

OGRCoordinateTransformationOptions::~OGRCoordinateTransformationOptions ( )

Destroys a OGRCoordinateTransformationOptions.

Since
GDAL 3.0

Member Function Documentation

◆ operator=()

OGRCoordinateTransformationOptions & OGRCoordinateTransformationOptions::operator= ( const OGRCoordinateTransformationOptions other)

Assignment operator.

Since
GDAL 3.1

◆ SetAreaOfInterest()

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.

Parameters
dfWestLongitudeDegWest longitude (in degree). Must be in [-180,180]
dfSouthLatitudeDegSouth latitude (in degree). Must be in [-90,90]
dfEastLongitudeDegEast longitude (in degree). Must be in [-180,180]
dfNorthLatitudeDegNorth latitude (in degree). Must be in [-90,90]
Returns
true in case of success.
Since
GDAL 3.0

◆ SetBallparkAllowed()

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.

Parameters
bAllowBallparkfalse to disable the user of ballpark transformations
Since
GDAL 3.3

◆ SetCoordinateOperation()

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

Parameters
pszCOPROJ or WKT string describing a coordinate operation
bReverseCOWhether the PROJ or WKT string should be evaluated in the reverse path
Returns
true in case of success.
Since
GDAL 3.0

◆ SetDesiredAccuracy()

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.

Parameters
dfAccuracyaccuracy in meters (or a negative value to disable this filter)
Since
GDAL 3.3

◆ SetOnlyBest()

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.

Parameters
bOnlyBestset to true to ask PROJ to use only the best operation(s)
Since
GDAL 3.8 and PROJ 9.2

The documentation for this struct was generated from the following files: