Commit 12eb60ec authored by Cédric Traizet's avatar Cédric Traizet

BUG: don't add a GCP object to the image metadata when GDAL GCPs have no projection attached

parent a838f605
Pipeline #7049 passed with stages
in 129 minutes and 53 seconds
......@@ -832,36 +832,40 @@ void GDALImageIO::InternalReadImageInformation()
{
gcpCount = 0; // fix for uninitialized gcpCount in gdal (when
// reading Palsar image)
}
std::string key;
itk::EncapsulateMetaData<unsigned int>(dict, MetaDataKey::GCPCountKey, gcpCount);
itk::EncapsulateMetaData<unsigned int>(dict, MetaDataKey::GCPCountKey, 0);
for (unsigned int cpt = 0; cpt < gcpCount; ++cpt)
}
else
{
itk::EncapsulateMetaData<unsigned int>(dict, MetaDataKey::GCPCountKey, gcpCount);
const GDAL_GCP* psGCP;
psGCP = dataset->GetGCPs() + cpt;
GCP pOtbGCP;
pOtbGCP.m_Id = std::string(psGCP->pszId);
pOtbGCP.m_Info = std::string(psGCP->pszInfo);
pOtbGCP.m_GCPRow = psGCP->dfGCPLine;
pOtbGCP.m_GCPCol = psGCP->dfGCPPixel;
pOtbGCP.m_GCPX = psGCP->dfGCPX;
pOtbGCP.m_GCPY = psGCP->dfGCPY;
pOtbGCP.m_GCPZ = psGCP->dfGCPZ;
// Complete the key with the GCP number : GCP_i
std::ostringstream lStream;
lStream << MetaDataKey::GCPParametersKey << cpt;
key = lStream.str();
std::string key;
for (unsigned int cpt = 0; cpt < gcpCount; ++cpt)
{
itk::EncapsulateMetaData<GCP>(dict, key, pOtbGCP);
gcps.GCPs.push_back(pOtbGCP);
const GDAL_GCP* psGCP;
psGCP = dataset->GetGCPs() + cpt;
GCP pOtbGCP;
pOtbGCP.m_Id = std::string(psGCP->pszId);
pOtbGCP.m_Info = std::string(psGCP->pszInfo);
pOtbGCP.m_GCPRow = psGCP->dfGCPLine;
pOtbGCP.m_GCPCol = psGCP->dfGCPPixel;
pOtbGCP.m_GCPX = psGCP->dfGCPX;
pOtbGCP.m_GCPY = psGCP->dfGCPY;
pOtbGCP.m_GCPZ = psGCP->dfGCPZ;
// Complete the key with the GCP number : GCP_i
std::ostringstream lStream;
lStream << MetaDataKey::GCPParametersKey << cpt;
key = lStream.str();
itk::EncapsulateMetaData<GCP>(dict, key, pOtbGCP);
gcps.GCPs.push_back(pOtbGCP);
}
m_Imd.Add(MDGeom::GCP, gcps);
}
m_Imd.Add(MDGeom::GCP, gcps);
}
/* -------------------------------------------------------------------- */
......
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