OTB  9.0.0
Orfeo Toolbox
Public Types | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
otb::GDALRPCTransformer Class Referencefinal

#include <otbGDALRPCTransformer.h>

+ Inheritance diagram for otb::GDALRPCTransformer:
+ Collaboration diagram for otb::GDALRPCTransformer:

Public Types

using PointType = itk::Point< double, 3 >
 

Public Member Functions

bool ForwardTransform (double *x, double *y, double *z, int nPointCount)
 
PointType ForwardTransform (PointType p)
 
 GDALRPCTransformer (const Projection::RPCParam &, bool useDEM)
 
 GDALRPCTransformer (double LineOffset, double SampleOffset, double LatOffset, double LonOffset, double HeightOffset, double LineScale, double SampleScale, double LatScale, double LonScale, double HeightScale, const double(&LineNum)[20], const double(&LineDen)[20], const double(&SampleNum)[20], const double(&SampleDen)[20], bool useDEM)
 
bool InverseTransform (double *x, double *y, double *z, int nPointCount)
 
PointType InverseTransform (PointType p)
 
void SetOption (const std::string &Name, const std::string &Value)
 
void SetPixErrThreshold (double PixErrThreshold)
 
 ~GDALRPCTransformer ()
 

Protected Member Functions

void Update () final
 
- Protected Member Functions inherited from otb::DEMObserverInterface
 DEMObserverInterface ()=default
 
 DEMObserverInterface (DEMObserverInterface const &)=delete
 
DEMObserverInterfaceoperator= (DEMObserverInterface const &)=delete
 
 ~DEMObserverInterface ()=default
 

Private Attributes

GDALRPCInfo m_GDALRPCInfo
 
bool m_Modified = true
 
std::mutex m_Mutex
 
char ** m_Options = nullptr
 
double m_PixErrThreshold = 0.1
 
void * m_TransformArg = nullptr
 
bool m_UseDEM = true
 

Detailed Description

This class is a wrapper around GDALCreateRPCTransformer and GDALRPCTransform.

This class aims at manipulating RPC transformations within OTB, in a safe and easy way.

To use this wrapper, one needs to call the constructor with the correct parameters. Then, one can set the options, and the threshold. Finally, one can call ForwardTransform or BackwardTransform, depending in the desired result.

The parameters provided to the constructor are those found in the RPCParam structure defined in the otbGeometryMetadata.h file. They are quite similar to what can be found in GDALRPCInfo.

Definition at line 52 of file otbGDALRPCTransformer.h.

Member Typedef Documentation

◆ PointType

using otb::GDALRPCTransformer::PointType = itk::Point<double, 3>

Definition at line 56 of file otbGDALRPCTransformer.h.

Constructor & Destructor Documentation

◆ GDALRPCTransformer() [1/2]

otb::GDALRPCTransformer::GDALRPCTransformer ( double  LineOffset,
double  SampleOffset,
double  LatOffset,
double  LonOffset,
double  HeightOffset,
double  LineScale,
double  SampleScale,
double  LatScale,
double  LonScale,
double  HeightScale,
const double(&)  LineNum[20],
const double(&)  LineDen[20],
const double(&)  SampleNum[20],
const double(&)  SampleDen[20],
bool  useDEM 
)

Build a GDALRPCTransformer

The parameters describe the RPC model. They can be found in the RPCParam structure defined in the otbGeometryMetadata.h file. They are quite similar to what can be found in GDALRPCInfo. See also http://geotiff.maptools.org/rpc_prop.html

◆ GDALRPCTransformer() [2/2]

otb::GDALRPCTransformer::GDALRPCTransformer ( const Projection::RPCParam ,
bool  useDEM 
)

◆ ~GDALRPCTransformer()

otb::GDALRPCTransformer::~GDALRPCTransformer ( )

Member Function Documentation

◆ ForwardTransform() [1/2]

bool otb::GDALRPCTransformer::ForwardTransform ( double *  x,
double *  y,
double *  z,
int  nPointCount 
)

Compute a forward transformation

This method performs a transformation from column/row to long/lat/height space. It can work with an arbitrary number of points.

Parameters
[in,out]xarray of the X coordinate of the points to convert
[in,out]yarray of the Y coordinate of the points to convert
[in,out]zarray of the Z coordinate of the points to convert
[in]nPointCountthe number of points to convert
Returns
true if all points were correctly transformed
Precondition
x, y, z != nullptr

◆ ForwardTransform() [2/2]

PointType otb::GDALRPCTransformer::ForwardTransform ( PointType  p)

Compute an forward transformation

This method performs a transformation from column/row to long/lat/height space. It works with only one point.

Parameters
[in]pcoordinates of the point to convert
Returns
the coordinates of the converted point

◆ InverseTransform() [1/2]

bool otb::GDALRPCTransformer::InverseTransform ( double *  x,
double *  y,
double *  z,
int  nPointCount 
)

Compute an inverse transformation

This method performs a transformation from long/lat/height to column/row space. It can work with an arbitrary number of points.

Parameters
[in,out]xarray of the X coordinate of the points to convert
[in,out]yarray of the Y coordinate of the points to convert
[in,out]zarray of the Z coordinate of the points to convert
[in]nPointCountthe number of points to convert
Returns
true if all points were correctly transformed
Precondition
x, y, z != nullptr

◆ InverseTransform() [2/2]

PointType otb::GDALRPCTransformer::InverseTransform ( PointType  p)

Compute an inverse transformation

This method performs a transformation from long/lat/height to column/row space. It works with only one point.

Parameters
[in]pcoordinates of the point to convert
Returns
the coordinates of the converted point

◆ SetOption()

void otb::GDALRPCTransformer::SetOption ( const std::string &  Name,
const std::string &  Value 
)

Set additional options to the transformer

  • RPC_HEIGHT: a fixed height offset to be applied to all points passed in. In this situation the Z passed into the transformation function is assumed to be height above ground, and the RPC_HEIGHT is assumed to be an average height above sea level for ground in the target scene.

  • RPC_HEIGHT_SCALE: a factor used to multiply heights above ground. Useful when elevation offsets of the DEM are not expressed in meters.

  • RPC_DEM: the name of a GDAL dataset (a DEM file typically) used to extract elevation offsets from. In this situation the Z passed into the transformation function is assumed to be height above ground. This option should be used in replacement of RPC_HEIGHT to provide a way of defining a non uniform ground for the target scene

  • RPC_DEMINTERPOLATION: the DEM interpolation ("near", "bilinear" or "cubic"). Default is "bilinear".

  • RPC_DEM_MISSING_VALUE: value of DEM height that must be used in case the DEM has nodata value at the sampling point, or if its extent does not cover the requested coordinate. When not specified, missing values will cause a failed transform.

  • RPC_DEM_SRS: (GDAL >= 3.2) WKT SRS, or any string recognized by OGRSpatialReference::SetFromUserInput(), to be used as an override for DEM SRS. Useful if DEM SRS does not have an explicit vertical component.

  • RPC_DEM_APPLY_VDATUM_SHIFT: whether the vertical component of a compound SRS for the DEM should be used (when it is present). This is useful so as to be able to transform the "raw" values from the DEM expressed with respect to a geoid to the heights with respect to the WGS84 ellipsoid. When this is enabled, the GTIFF_REPORT_COMPD_CS configuration option will be also set temporarily so as to get the vertical information from GeoTIFF files. Defaults to TRUE. (GDAL >= 2.1.0)

  • RPC_PIXEL_ERROR_THRESHOLD: overrides the dfPixErrThreshold parameter, ie the error (measured in pixels) allowed in the iterative solution of pixel/line to lat/long computations (the other way is always exact given the equations). (GDAL >= 2.1.0)

  • RPC_MAX_ITERATIONS: maximum number of iterations allowed in the iterative solution of pixel/line to lat/long computations. Default value is 10 in the absence of a DEM, or 20 if there is a DEM. (GDAL >= 2.1.0)

  • RPC_FOOTPRINT: WKT or GeoJSON polygon (in long / lat coordinate space) with a validity footprint for the RPC. Any coordinate transformation that goes from or arrive outside this footprint will be considered invalid. This is useful in situations where the RPC values become highly unstable outside of the area on which they have been computed for, potentially leading to undesirable "echoes" / false positives. This requires GDAL to be built against GEOS.
Parameters
[in]Namea string containing the name of the option
[in]Valuea string containing the value of the option

◆ SetPixErrThreshold()

void otb::GDALRPCTransformer::SetPixErrThreshold ( double  PixErrThreshold)

Set the error (measured in pixels) allowed in the iterative solution of pixel/line to lat/long computations (the other way is always exact given the equations). Starting with GDAL 2.1, this may also be set through the RPC_PIXEL_ERROR_THRESHOLD transformer option. If a negative or null value is provided, then this defaults to 0.1 pixel.

Parameters
[in]PixErrThresholdthe new value of the error

◆ Update()

void otb::GDALRPCTransformer::Update ( )
finalprotectedvirtual

Regenerate the transformer

Called when performing a transformation and some options were modified.

Implements otb::DEMObserverInterface.

Member Data Documentation

◆ m_GDALRPCInfo

GDALRPCInfo otb::GDALRPCTransformer::m_GDALRPCInfo
private

The RPC model

Definition at line 216 of file otbGDALRPCTransformer.h.

◆ m_Modified

bool otb::GDALRPCTransformer::m_Modified = true
private

Used to know if Update is required after a change in the options

Definition at line 213 of file otbGDALRPCTransformer.h.

◆ m_Mutex

std::mutex otb::GDALRPCTransformer::m_Mutex
private

Lock threads when instantiating the GDAL RPC transformer

Definition at line 228 of file otbGDALRPCTransformer.h.

◆ m_Options

char** otb::GDALRPCTransformer::m_Options = nullptr
private

The options

Definition at line 219 of file otbGDALRPCTransformer.h.

◆ m_PixErrThreshold

double otb::GDALRPCTransformer::m_PixErrThreshold = 0.1
private

The error allowed in the iterative solution

Definition at line 222 of file otbGDALRPCTransformer.h.

◆ m_TransformArg

void* otb::GDALRPCTransformer::m_TransformArg = nullptr
private

The transformer arguments

Definition at line 225 of file otbGDALRPCTransformer.h.

◆ m_UseDEM

bool otb::GDALRPCTransformer::m_UseDEM = true
private

Use the DEM singleton in DEM computations

Definition at line 231 of file otbGDALRPCTransformer.h.


The documentation for this class was generated from the following file: