From 9d6d01678bbd6f7c2e5f1b30ce82493b9911d481 Mon Sep 17 00:00:00 2001 From: Manuel Grizonnet <manuel.grizonnet@orfeo-toolbox.org> Date: Mon, 1 Sep 2014 14:59:21 +0200 Subject: [PATCH] ENH: return orientation as azimuth if incidences angles are not available in metadata --- Code/IO/otbPleiadesImageMetadataInterface.cxx | 40 +++++++++++++------ 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/Code/IO/otbPleiadesImageMetadataInterface.cxx b/Code/IO/otbPleiadesImageMetadataInterface.cxx index f04923faac..321a9892c8 100644 --- a/Code/IO/otbPleiadesImageMetadataInterface.cxx +++ b/Code/IO/otbPleiadesImageMetadataInterface.cxx @@ -708,29 +708,43 @@ PleiadesImageMetadataInterface::GetSatAzimuth() const itk::ExposeMetaData<ImageKeywordlistType>(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist); } - if (!imageKeywordlist.HasKey("support_data.scene_orientation") || !imageKeywordlist.HasKey("support_data.along_track_incidence_angle") || !imageKeywordlist.HasKey("support_data.across_track_incidence_angle")) + if (!imageKeywordlist.HasKey("support_data.scene_orientation")) { return 0; } + else if (!imageKeywordlist.HasKey("support_data.along_track_incidence_angle") || !imageKeywordlist.HasKey("support_data.across_track_incidence_angle")) + { + // MSD: for the moment take only topCenter value + std::string valueString = imageKeywordlist.GetMetadataByKey("support_data.scene_orientation"); + double cap = atof(valueString.c_str()); - // MSD: for the moment take only topCenter value - std::string valueString = imageKeywordlist.GetMetadataByKey("support_data.scene_orientation"); - double cap = atof(valueString.c_str()); + //return only orientation if across/along track incidence are not available + return cap; + } + else + { + //Got orientation and incidences angle which allow to compute satellite + // azimuthal angle + + // MSD: for the moment take only topCenter value + std::string valueString = imageKeywordlist.GetMetadataByKey("support_data.scene_orientation"); + double cap = atof(valueString.c_str()); - valueString = imageKeywordlist.GetMetadataByKey("support_data.along_track_incidence_angle"); - double along = atof(valueString.c_str()); + valueString = imageKeywordlist.GetMetadataByKey("support_data.along_track_incidence_angle"); + double along = atof(valueString.c_str()); - valueString = imageKeywordlist.GetMetadataByKey("support_data.across_track_incidence_angle"); - double ortho = atof(valueString.c_str()); + valueString = imageKeywordlist.GetMetadataByKey("support_data.across_track_incidence_angle"); + double ortho = atof(valueString.c_str()); - //Compute Satellite azimuthal angle using the azimuthal angle and the along - //and across track incidence angle + //Compute Satellite azimuthal angle using the azimuthal angle and the along + //and across track incidence angle - double satAz = (cap - vcl_atan2(vcl_tan(ortho * CONST_PI_180),vcl_tan(along * CONST_PI_180)) * CONST_180_PI); + double satAz = (cap - vcl_atan2(vcl_tan(ortho * CONST_PI_180),vcl_tan(along * CONST_PI_180)) * CONST_180_PI); - satAz = fmod(satAz,360); + satAz = fmod(satAz,360); - return satAz; + return satAz; + } } PleiadesImageMetadataInterface::VariableLengthVectorType -- GitLab