Commit b4e73c1b authored by Cédric Traizet's avatar Cédric Traizet

BUG: set RPCs with OssimKWL for sensor that don't use the new metadata framework yet

parent 289609b1
......@@ -1490,6 +1490,10 @@ std::cout << m_Imd << std::endl;
std::abs(geoTransform[4]) > Epsilon ||
std::abs(geoTransform[5] - 1.0) > Epsilon;
itk::MetaDataDictionary& dict = this->GetMetaDataDictionary();
ImageKeywordlist otb_kwl;
itk::ExposeMetaData<ImageKeywordlist>(dict, MetaDataKey::OSSIMKeywordlistKey, otb_kwl);
/* -------------------------------------------------------------------- */
/* Case 1: Set the projection coordinate system of the image */
/* -------------------------------------------------------------------- */
......@@ -1531,6 +1535,25 @@ std::cout << m_Imd << std::endl;
CSLDestroy(rpcMetadata);
}
}
// ToDo : remove this part. This case is here for compatibility for images
// that still use Ossim for managing the sensor model (with OSSIMKeywordList).
else if (otb_kwl.GetSize())
{
/* -------------------------------------------------------------------- */
/* Set the RPC coeffs (since GDAL 1.10.0) */
/* -------------------------------------------------------------------- */
if (m_WriteRPCTags)
{
GDALRPCInfo gdalRpcStruct;
if (otb_kwl.convertToGDALRPC(gdalRpcStruct))
{
otbLogMacro(Debug, << "Saving RPC to file (" << m_FileName << ")")
char** rpcMetadata = RPCInfoToMD(&gdalRpcStruct);
dataset->SetMetadata(rpcMetadata, "RPC");
CSLDestroy(rpcMetadata);
}
}
}
/* -------------------------------------------------------------------- */
/* Case 3: Set the GCPs */
/* -------------------------------------------------------------------- */
......@@ -1562,7 +1585,6 @@ std::cout << m_Imd << std::endl;
}
const std::string & gcpProjectionRef = gcpPrm.GCPProjection;
dataset->SetGCPs(gdalGcps.size(), gdalGcps.data(), gcpProjectionRef.c_str());
// disable geotransform with GCP
......
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