Commit d909d88a authored by Emmanuel Christophe's avatar Emmanuel Christophe

Corrections pour lambert + inversions lat/lon avec ossim

parent 5520ebd7
......@@ -58,7 +58,8 @@ namespace otb
double GetFalseEasting() const;
void SetParameters(double parallel1Degree,double parallel2Degree,double falseEasting,double falseNorthing);
void SetDefaults();
protected:
LambertConformalConicMapProjection();
virtual ~LambertConformalConicMapProjection();
......
......@@ -100,6 +100,7 @@ namespace otb
virtual OutputPointType GetDecimalDegreesPerPixel() const;
virtual void SetAB(double a, double b);
virtual void SetOrigin(const InputPointType &origin);
virtual void SetOrigin(const InputPointType &origin, std::string datumCode);
virtual void SetMetersPerPixel(const OutputPointType &point);
virtual void SetDecimalDegreesPerPixel(const OutputPointType &point);
virtual void ComputeDegreesPerPixel(const InputPointType &ground, const OutputPointType &metersPerPixel, double &deltaLat, double &deltaLon);
......
......@@ -290,7 +290,16 @@ namespace otb
void MapProjection<TOssimMapProjection, Transform, TScalarType, NInputDimensions, NOutputDimensions>
::SetOrigin(const InputPointType &origin)
{
ossimGpt ossimOrigin(origin[0], origin[1]);
ossimGpt ossimOrigin(origin[1], origin[0]);
m_MapProjection->setOrigin(ossimOrigin);
}
///Set the origin in a given datum
template<class TOssimMapProjection, InverseOrForwardTransformationEnum Transform, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions>
void MapProjection<TOssimMapProjection, Transform, TScalarType, NInputDimensions, NOutputDimensions>
::SetOrigin(const InputPointType &origin, std::string datumCode)
{
ossimGpt ossimOrigin(origin[1], origin[0], 0, ossimDatumFactory::instance()->create(datumCode));
m_MapProjection->setOrigin(ossimOrigin);
}
......@@ -318,7 +327,7 @@ namespace otb
::ComputeDegreesPerPixel(const InputPointType &ground, const OutputPointType &metersPerPixel, double &deltaLat, double &deltaLon)
{
ossimDpt ossimMetersPerPixel(metersPerPixel[0], metersPerPixel[1]);
ossimGpt ossimGround(ground[0],ground[1]);
ossimGpt ossimGround(ground[1],ground[0]);
m_MapProjection->computeDegreesPerPixel(ossimGround,ossimMetersPerPixel,deltaLat,deltaLon);
}
......@@ -329,7 +338,7 @@ namespace otb
::ComputeMetersPerPixel(const InputPointType &center, double deltaDegreesPerPixelLat, double deltaDegreesPerPixelLon, OutputPointType &metersPerPixel)
{
//Correction
ossimGpt ossimCenter(center[0],center[1]);
ossimGpt ossimCenter(center[1],center[0]);
ossimDpt ossimMetersPerPixel;
m_MapProjection->computeMetersPerPixel(ossimCenter,deltaDegreesPerPixelLat, deltaDegreesPerPixelLon,ossimMetersPerPixel);
metersPerPixel[0]=ossimMetersPerPixel.x;
......
......@@ -49,7 +49,6 @@ namespace otb
/** Run-time type information (and related methods). */
itkTypeMacro( TransMercatorMapProjection, MapProjection );
virtual void SetEllipsoid();
virtual void SetFalseEasting(double falseEasting);
virtual void SetFalseNorthing(double falseNorthing);
virtual void SetScaleFactor(double scaleFactor);
......
......@@ -27,6 +27,10 @@ namespace otb
TransMercatorMapProjection<transform>
::TransMercatorMapProjection()
{
ossimEllipsoid ellipsoid= *(ossimEllipsoidFactory::instance()->create("WE"));
ossimGpt origin(49.83,6.16); //TODO check where this is coming from
this->m_MapProjection->setEllipsoid(ellipsoid);
this->m_MapProjection->setOrigin(origin);
}
/// Desctructor
......@@ -36,17 +40,6 @@ namespace otb
{
}
///Set the default ellipsoid
template <InverseOrForwardTransformationEnum transform>
void TransMercatorMapProjection<transform>
::SetEllipsoid()
{
ossimEllipsoid ellipse(6378137.0,6356752.3142);
ossimGpt origin(49.83,6.16);
delete (this->m_MapProjection);
this->m_MapProjection = new ossimTransMercatorProjection(ellipse,origin,80000.0,100000.0,1.0);
}
///Set the false Easting
template <InverseOrForwardTransformationEnum transform>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment