GDAL

Classes | Macros | Functions
ogr_spatialref.h File Reference
`#include "cpl_string.h"`
`#include "ogr_srs_api.h"`
`#include <cstddef>`
`#include <map>`
`#include <memory>`
`#include <vector>`

Go to the source code of this file.

## Classes
class | OGR_SRSNode
| Objects of this class are used to represent value nodes in the parsed representation of the WKT SRS format. More...
struct | OGR_SRSNode::Listener
| Listener that is notified of modification to nodes. More...
class | OGRSpatialReference
| This class represents an OpenGIS Spatial Reference System, and contains methods for converting between this object organization and well known text (WKT) format. More...
class | OGRCoordinateTransformation
| Interface for transforming between coordinate systems. More...
struct | OGRCoordinateTransformationOptions
| Context for coordinate transformation. More...

## Macros
#define | USGS_ANGLE_DECIMALDEGREES 0
| Angle is in decimal degrees.
#define | USGS_ANGLE_PACKEDDMS TRUE
| Angle is in packed degree minute second.
#define | USGS_ANGLE_RADIANS 2
| Angle is in radians.

## Functions
OGRCoordinateTransformation * | OGRCreateCoordinateTransformation (const OGRSpatialReference *poSource, const OGRSpatialReference *poTarget)
| Create transformation object. More...
OGRCoordinateTransformation * | OGRCreateCoordinateTransformation (const OGRSpatialReference *poSource, const OGRSpatialReference *poTarget, const OGRCoordinateTransformationOptions &options)
| Create transformation object. More...

## Detailed Description

Coordinate systems services.

## Function Documentation

## ◆ OGRCreateCoordinateTransformation() [1/2]

OGRCoordinateTransformation* OGRCreateCoordinateTransformation | ( | const OGRSpatialReference * | poSource,
|  | const OGRSpatialReference * | poTarget
| ) |  |

Create transformation object.

This is the same as the C function OCTNewCoordinateTransformation().

Input spatial reference system objects are assigned by copy (calling clone() method) and no ownership transfer occurs.

The delete operator, or OCTDestroyCoordinateTransformation() should be used to destroy transformation objects.

This will honour the axis order advertized by the source and target SRS, as well as their "data axis to SRS axis mapping". To have a behavior similar to GDAL < 3.0, the OGR_CT_FORCE_TRADITIONAL_GIS_ORDER configuration option can be set to YES.

Parameters

  poSource | source spatial reference system.
  poTarget | target spatial reference system.

Returns
  NULL on failure or a ready to use transformation object.

## ◆ OGRCreateCoordinateTransformation() [2/2]

OGRCoordinateTransformation* OGRCreateCoordinateTransformation | ( | const OGRSpatialReference * | poSource,
|  | const OGRSpatialReference * | poTarget,
|  | const OGRCoordinateTransformationOptions & | options
| ) |  |

Create transformation object.

This is the same as the C function OCTNewCoordinateTransformationEx().

Input spatial reference system objects are assigned by copy (calling clone() method) and no ownership transfer occurs.

The delete operator, or OCTDestroyCoordinateTransformation() should be used to destroy transformation objects.

This will honour the axis order advertized by the source and target SRS, as well as their "data axis to SRS axis mapping". To have a behavior similar to GDAL < 3.0, the OGR_CT_FORCE_TRADITIONAL_GIS_ORDER configuration option can be set to YES.

The source SRS and target SRS should generally not be NULL. This is only allowed if a custom coordinate operation is set through the hOptions argument.

Starting with GDAL 3.0.3, the OGR_CT_OP_SELECTION configuration option can be set to PROJ (default if PROJ >= 6.3), BEST_ACCURACY or FIRST_MATCHING to decide of the strategy to select the operation to use among candidates, whose area of use is compatible with the points to transform. It is only taken into account if no user defined coordinate transformation pipeline has been specified.

- PROJ means the default behavior used by PROJ proj_create_crs_to_crs(). In particular the operation to use among several initial candidates is evaluated for each point to transform.
- BEST_ACCURACY means the operation whose accuracy is best. It should be close to PROJ behavior, except that the operation to select is decided for the average point of the coordinates passed in a single Transform() call. Note: if the OGRCoordinateTransformationOptions::SetDesiredAccuracy() or OGRCoordinateTransformationOptions::SetBallparkAllowed() methods are called with PROJ < 8, this strategy will be selected instead of PROJ.
- FIRST_MATCHING is the operation ordered first in the list of candidates: it will not necessarily have the best accuracy, but generally a larger area of use. It is evaluated for the average point of the coordinates passed in a single Transform() call. This was the default behavior for GDAL 3.0.0 to 3.0.2

If options contains a user defined coordinate transformation pipeline, it will be unconditionally used. If options has an area of interest defined, it will be used to research the best fitting coordinate transformation (which will be used for all coordinate transformations, even if they don't fall into the declared area of interest) If no options are set, then a list of candidate coordinate operations will be researched, and at each call to Transform(), the best of those candidate regarding the centroid of the coordinate set will be dynamically selected.

Parameters

  poSource | source spatial reference system.
  poTarget | target spatial reference system.
  options | Coordinate transformation options.

Returns
  NULL on failure or a ready to use transformation object.

Since
  GDAL 3.0