Commit 318afdd6 authored by Cédric Traizet's avatar Cédric Traizet

Merge branch '2157_gcp_noprojection_fix' into 'develop'

Don't add a GCP object to the image metadata when GCPs have no projection attached

Closes #2157

See merge request !801
parents f7198f60 12eb60ec
Pipeline #7134 passed with stages
in 5 minutes and 42 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