GDAL
|
Interface for transforming between coordinate systems. More...
#include <ogr_spatialref.h>
Inherited by AxisMappingCoordinateTransformation, CompositeCT, CutlineTransformer, GCPCoordTransformation, and GeoTransformCoordinateTransformation.
Public Member Functions | |
virtual const OGRSpatialReference * | GetSourceCS () const =0 |
Fetch internal source coordinate system. | |
virtual const OGRSpatialReference * | GetTargetCS () const =0 |
Fetch internal target coordinate system. | |
virtual bool | GetEmitErrors () const |
Whether the transformer will emit CPLError. | |
virtual void | SetEmitErrors (bool) |
Set if the transformer must emit CPLError. | |
int | Transform (size_t nCount, double *x, double *y, double *z=nullptr, int *pabSuccess=nullptr) |
Transform points from source to destination space. | |
virtual int | Transform (size_t nCount, double *x, double *y, double *z, double *t, int *pabSuccess)=0 |
Transform points from source to destination space. | |
virtual int | TransformWithErrorCodes (size_t nCount, double *x, double *y, double *z, double *t, int *panErrorCodes) |
Transform points from source to destination space. | |
virtual int | TransformBounds (const double xmin, const double ymin, const double xmax, const double ymax, double *out_xmin, double *out_ymin, double *out_xmax, double *out_ymax, const int densify_pts) |
Transform boundary. | |
virtual OGRCoordinateTransformation * | Clone () const =0 |
Clone. | |
virtual OGRCoordinateTransformation * | GetInverse () const =0 |
Return a coordinate transformation that performs the inverse transformation of the current one. | |
Static Public Member Functions | |
static void | DestroyCT (OGRCoordinateTransformation *poCT) |
OGRCoordinateTransformation destructor. | |
static OGRCoordinateTransformationH | ToHandle (OGRCoordinateTransformation *poCT) |
Convert a OGRCoordinateTransformation* to a OGRCoordinateTransformationH. | |
static OGRCoordinateTransformation * | FromHandle (OGRCoordinateTransformationH hCT) |
Convert a OGRCoordinateTransformationH to a OGRCoordinateTransformation*. | |
Interface for transforming between coordinate systems.
Currently, the only implementation within OGR is OGRProjCT, which requires the PROJ library.
Also, see OGRCreateCoordinateTransformation() for creating transformations.
|
pure virtual |
Clone.
|
static |
OGRCoordinateTransformation destructor.
This function is the same as OGRCoordinateTransformation::~OGRCoordinateTransformation() and OCTDestroyCoordinateTransformation()
This static method will destroy a OGRCoordinateTransformation. It is equivalent to calling delete on the object, but it ensures that the deallocation is properly executed within the OGR libraries heap on platforms where this can matter (win32).
poCT | the object to delete |
|
inlinestatic |
Convert a OGRCoordinateTransformationH to a OGRCoordinateTransformation*.
|
pure virtual |
Return a coordinate transformation that performs the inverse transformation of the current one.
In some cases, this is not possible, and this method might return nullptr, or fail to perform the transformations.
|
inlinestatic |
Convert a OGRCoordinateTransformation* to a OGRCoordinateTransformationH.
|
pure virtual |
Transform points from source to destination space.
This method is the same as the C function OCTTransform4D().
nCount | number of points to transform (size_t type since 3.9, int in previous versions). |
x | array of nCount X vertices, modified in place. Should not be NULL. |
y | array of nCount Y vertices, modified in place. Should not be NULL. |
z | array of nCount Z vertices, modified in place. Might be NULL. |
t | array of nCount time values, modified in place. Might be NULL. |
pabSuccess | array of per-point flags set to TRUE if that point transforms, or FALSE if it does not. Might be NULL. |
int OGRCoordinateTransformation::Transform | ( | size_t | nCount, |
double * | x, | ||
double * | y, | ||
double * | z = nullptr , |
||
int * | pabSuccess = nullptr |
||
) |
Transform points from source to destination space.
This method is the same as the C function OCTTransformEx().
nCount | number of points to transform (size_t type since 3.9, int in previous versions). |
x | array of nCount X vertices, modified in place. Should not be NULL. |
y | array of nCount Y vertices, modified in place. Should not be NULL. |
z | array of nCount Z vertices, modified in place. Might be NULL. |
pabSuccess | array of per-point flags set to TRUE if that point transforms, or FALSE if it does not. Might be NULL. |
|
inlinevirtual |
Transform boundary.
This method is the same as the C function OCTTransformBounds().
Transform boundary densifying the edges to account for nonlinear transformations along these edges and extracting the outermost bounds.
If the destination CRS is geographic, the first axis is longitude, and xmax < xmin then the bounds crossed the antimeridian. In this scenario there are two polygons, one on each side of the antimeridian. The first polygon should be constructed with (xmin, ymin, 180, ymax) and the second with (-180, ymin, xmax, ymax).
If the destination CRS is geographic, the first axis is latitude, and ymax < ymin then the bounds crossed the antimeridian. In this scenario there are two polygons, one on each side of the antimeridian. The first polygon should be constructed with (ymin, xmin, ymax, 180) and the second with (ymin, -180, ymax, xmax).
xmin | Minimum bounding coordinate of the first axis in source CRS. |
ymin | Minimum bounding coordinate of the second axis in source CRS. |
xmax | Maximum bounding coordinate of the first axis in source CRS. |
ymax | Maximum bounding coordinate of the second axis in source CRS. |
out_xmin | Minimum bounding coordinate of the first axis in target CRS |
out_ymin | Minimum bounding coordinate of the second axis in target CRS. |
out_xmax | Maximum bounding coordinate of the first axis in target CRS. |
out_ymax | Maximum bounding coordinate of the second axis in target CRS. |
densify_pts | Recommended to use 21. This is the number of points to use to densify the bounding polygon in the transformation. |
|
virtual |
Transform points from source to destination space.
This method is the same as the C function OCTTransform4DWithErrorCodes().
nCount | number of points to transform (size_t type since 3.9, int in previous versions). |
x | array of nCount X vertices, modified in place. Should not be NULL. |
y | array of nCount Y vertices, modified in place. Should not be NULL. |
z | array of nCount Z vertices, modified in place. Might be NULL. |
t | array of nCount time values, modified in place. Might be NULL. |
panErrorCodes | Output array of nCount value that will be set to 0 for success, or a non-zero value for failure. Refer to PROJ 8 public error codes. Might be NULL |