Commit 445d0bef authored by Julien Osman's avatar Julien Osman
Browse files

ENH: Read and write "AREA_OR_POINT"

parent d659aa73
Pipeline #7943 failed with stages
in 86 minutes and 8 seconds
......@@ -179,6 +179,7 @@ enum class MDStr
OrbitDirection,
BeamMode,
BeamSwath,
AreaOrPoint,
// ...
END
};
......
......@@ -424,6 +424,7 @@ MDStrBmType MDStrNames = bimapGenerator<MDStr>(std::map<MDStr, std::string> {
{MDStr::BandName,"BandName"},
{MDStr::BeamMode, "BeamMode"},
{MDStr::BeamSwath, "BeamSwath"},
{MDStr::AreaOrPoint, "AreaOrPoint"},
});
MDTimeBmType MDTimeNames = bimapGenerator<MDTime>(std::map<MDTime, std::string> {
......
......@@ -1126,6 +1126,12 @@ void GDALImageIO::InternalReadImageInformation()
itk::EncapsulateMetaData<MetaDataKey::BoolVectorType>(dict, MetaDataKey::NoDataValueAvailable, isNoDataAvailable);
itk::EncapsulateMetaData<MetaDataKey::VectorType>(dict, MetaDataKey::NoDataValue, noDataValues);
}
// Read AREA_OR_POINT value if present
papszMetadata = dataset->GetMetadata(nullptr);
auto areaOrPoint = CSLFetchNameValue(papszMetadata, "AREA_OR_POINT");
if (areaOrPoint)
m_Imd.Add(MDStr::AreaOrPoint, areaOrPoint);
}
bool GDALImageIO::CanWriteFile(const char* name)
......@@ -1638,6 +1644,14 @@ void GDALImageIO::InternalWriteImageInformation(const void* buffer)
// Write no-data flags from extended filenames
for (auto const& noData : m_NoDataList)
dataset->GetRasterBand(noData.first)->SetNoDataValue(noData.second);
/* -------------------------------------------------------------------- */
/* AREA_OR_POINT */
/* -------------------------------------------------------------------- */
// Write AREA_OR_POINT flag from ImageMetadata
if (m_Imd.Has(MDStr::AreaOrPoint))
dataset->SetMetadataItem("AREA_OR_POINT", m_Imd[MDStr::AreaOrPoint].c_str());
}
std::string GDALImageIO::FilenameToGdalDriverShortName(const std::string& name) const
......
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