21 #ifndef otbGenericMapProjection_hxx
22 #define otbGenericMapProjection_hxx
30 template <TransformDirection TDirectionOfMapping,
class TScalarType,
unsigned int NInputDimensions,
unsigned int NOutputDimensions>
32 :
Superclass(ParametersDimension), m_MapProjection()
36 template <TransformDirection TDirectionOfMapping,
class TScalarType,
unsigned int NInputDimensions,
unsigned int NOutputDimensions>
41 template <TransformDirection TDirectionOfMapping,
class TScalarType,
unsigned int NInputDimensions,
unsigned int NOutputDimensions>
49 return m_MapProjection->GetTargetSpatialReference().ToWkt();
53 return m_MapProjection->GetSourceSpatialReference().ToWkt();
59 template <TransformDirection TDirectionOfMapping,
class TScalarType,
unsigned int NInputDimensions,
unsigned int NOutputDimensions>
65 #if GDAL_VERSION_NUM >= 3000000
66 wgs84.SetAxisMappingStrategy(OAMS_TRADITIONAL_GIS_ORDER);
67 wktSpatialReference.SetAxisMappingStrategy(OAMS_TRADITIONAL_GIS_ORDER);
72 std::unique_ptr<CoordinateTransformation> newMapProjection(
new CoordinateTransformation(wktSpatialReference, wgs84));
75 m_MapProjection.swap(newMapProjection);
79 std::unique_ptr<CoordinateTransformation> newMapProjection(
new CoordinateTransformation(wgs84, wktSpatialReference));
82 m_MapProjection.swap(newMapProjection);
88 template <TransformDirection TDirectionOfMapping,
class TScalarType,
unsigned int NInputDimensions,
unsigned int NOutputDimensions>
99 if (InputPointType::PointDimension == 3)
102 std::tie(lon, lat, h) = m_MapProjection->Transform(std::make_tuple(point[0], point[1], z));
104 outputPoint[0] = lon;
105 outputPoint[1] = lat;
106 if (OutputPointType::PointDimension == 3)
114 if (InputPointType::PointDimension == 3)
116 std::tie(x, y, z) = m_MapProjection->Transform(std::make_tuple(point[0], point[1], h));
119 if (OutputPointType::PointDimension == 3)
127 template <TransformDirection TDirectionOfMapping,
class TScalarType,
unsigned int NInputDimensions,
unsigned int NOutputDimensions>
130 return m_MapProjection !=
nullptr;
133 template <TransformDirection TDirectionOfMapping,
class TScalarType,
unsigned int NInputDimensions,
unsigned int NOutputDimensions>
136 Superclass::PrintSelf(os, indent);
137 os << indent << *m_MapProjection.get() << std::endl;