OTB
9.0.0
Orfeo Toolbox
|
#include <otbSpatialReference.h>
Public Types | |
enum | hemisphere { hemisphere::north, hemisphere::south } |
typedef std::unique_ptr< OGRSpatialReference, internal::OGRSpatialReferenceDeleter > | OGRSpatialReferencePtr |
Public Member Functions | |
bool | NormalizeESRI () |
SpatialReference & | operator= (const SpatialReference &other) noexcept |
SpatialReference (const SpatialReference &other) noexcept | |
unsigned int | ToEPSG () const |
std::string | ToWkt () const |
Static Public Member Functions | |
static SpatialReference | FromDescription (const std::string &sr_description) |
static SpatialReference | FromEPSG (unsigned int epsg) |
static SpatialReference | FromGeogCS (const std::string &GeogName, const std::string &DatumName, const std::string &SpheroidName, const double SemiMajor, const double InvFlattening) |
static SpatialReference | FromUTM (unsigned int zone, hemisphere hem) |
static SpatialReference | FromWGS84 () |
static void | UTMFromGeoPoint (double lon, double lat, unsigned int &zone, hemisphere &hem) |
Private Member Functions | |
SpatialReference (const OGRSpatialReference *ref) | |
SpatialReference (OGRSpatialReferencePtr ref) | |
Private Attributes | |
OGRSpatialReferencePtr | m_SR |
Friends | |
class | CoordinateTransformation |
OTBGdalAdapters_EXPORT friend bool | operator!= (const SpatialReference &sr1, const SpatialReference &sr2) noexcept |
OTBGdalAdapters_EXPORT friend bool | operator== (const SpatialReference &sr1, const SpatialReference &sr2) noexcept |
This class is a wrapper around OGRSpatialReference.
This class is a wrapper around OGRSpatialReference. It aims at manipulating spatial reference within OTB, in a safe and easy way. The class provides several constructors that all enforce the RAII: either they fail or they provide a definitive, valid object.
Building a SpatialReference requires to call one of the From*() method. There are no public constructors (apart from copy and assignment)
Definition at line 79 of file otbSpatialReference.h.
typedef std::unique_ptr<OGRSpatialReference, internal::OGRSpatialReferenceDeleter> otb::SpatialReference::OGRSpatialReferencePtr |
Definition at line 86 of file otbSpatialReference.h.
|
strong |
Build a SpatialReference from a UTM zone passed to OGRSpatialReference::SetUTM() from GDAL
zone | UTM zone to use |
hem | hemisphere::north or hemisphere::south |
InvalidSRDescriptionException | in case of failure of setUTM() |
Enumerator | |
---|---|
north | |
south |
Definition at line 127 of file otbSpatialReference.h.
|
noexcept |
Copy constructor.
|
private |
Constructor from wrapped type. ref will be cloned.
|
private |
Constructor from unique_ptr to wrapped type. On success (no throw) the passed unique_ptr will be cleared, and ownership transferred
|
static |
Build a SpatialRereference from a description string. The description string is passed to OGRSpatialReference:SetFromUserInput() from GDAL. Currently, supported syntax is:
description | a string containing the description of the spatial reference to parse |
InvalidSRDescriptionException | in case of failure of SetFromUserInput() |
Referenced by otb::GenericMapProjection< TDirectionOfMapping, TScalarType, NInputDimensions, NOutputDimensions >::SetWkt().
|
static |
Build a SpatialReference from an epsg code
epsg | EPSG code passed to OGRSpatialReference::importFromEPSGA() from GDAL |
InvalidSRDescriptionException | in case of failure of importFromEPSGA() |
Referenced by otb::MapFileProductWriter< TInputImage >::InitializeVectorData(), otb::MapFileProductWriter< TInputImage >::Tiling(), and otb::MapFileProductWriter< TInputImage >::Write().
|
static |
Build a SpatialReference from the datum, ellipsoid, prime meridian and angular units.
See OGRSpatialReference::SetGeogCS for more details.
GeogName | user visible name for the geographic coordinate system |
DatumName | key name for this datum. |
SpheroidName | user visible spheroid name |
SemiMajor | the semi major axis of the spheroid |
InvFlattening | the inverse flattening for the spheroid |
InvalidSRDescriptionException | in case of failure of FromGeogCS() |
|
static |
|
static |
Build a SpatialRereference for wgs84
InvalidSRDescriptionException | (very unlikely since there is a standard method in gdal to build a WGS84 projection) |
Referenced by otb::Multi3DMapToDEMFilter< T3DImage, TMaskImage, TOutputDEMImage >::BeforeThreadedGenerateData(), otb::ImageToOSMVectorDataGenerator< TImage >::EstimateImageExtent(), otb::Multi3DMapToDEMFilter< T3DImage, TMaskImage, TOutputDEMImage >::SetOutputParametersFromImage(), otb::GenericRSResampleImageFilter< TInputImage, TOutputImage >::SetOutputParametersFromMap(), and otb::GenericMapProjection< TDirectionOfMapping, TScalarType, NInputDimensions, NOutputDimensions >::SetWkt().
bool otb::SpatialReference::NormalizeESRI | ( | ) |
Try to normalize spatial reference fields to be compatible with ESRI.
|
noexcept |
Assignment operator.
unsigned int otb::SpatialReference::ToEPSG | ( | ) | const |
Convert the spatial reference to an EPSG code
std::string otb::SpatialReference::ToWkt | ( | ) | const |
Export the spatial reference to a Well Known Text string
Referenced by otb::GenericRSResampleImageFilter< TInputImage, TOutputImage >::SetOutputParametersFromMap().
|
static |
Find which UTM zone a given (lat,lon) point falls in.
lon | Point longitude |
lat | Point latitude |
zone | Output UTM zone |
hem | output hemisphere |
Referenced by otb::GenericRSResampleImageFilter< TInputImage, TOutputImage >::SetOutputParametersFromMap().
|
friend |
Definition at line 81 of file otbSpatialReference.h.
|
friend |
Different operator (based on OGRSpatialReference::IsSame())
|
friend |
Equal operator (based on OGRSpatialReference::IsSame())
|
private |
Definition at line 204 of file otbSpatialReference.h.