Skip to content

Commit

Permalink
VRT processed dataset: Read scale and offset from src dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
dbaston committed Jan 6, 2025
1 parent 62d4c2f commit b1956fe
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions frmts/vrt/vrtprocesseddataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,8 @@ bool VRTProcessedDataset::ParseStep(const CPLXMLNode *psStep, bool bIsFinalStep,
for (int i = 1; i <= m_poSrcDS->GetRasterCount(); ++i)
{
int bHasVal = false;
const double dfVal = GetRasterBand(i)->GetOffset(&bHasVal);
const double dfVal =
m_poSrcDS->GetRasterBand(i)->GetOffset(&bHasVal);
oStep.aosArguments.AddNameValue(
CPLSPrintf("offset_%d", i),
CPLSPrintf("%.17g", bHasVal ? dfVal : 0.0));
Expand All @@ -580,7 +581,8 @@ bool VRTProcessedDataset::ParseStep(const CPLXMLNode *psStep, bool bIsFinalStep,
for (int i = 1; i <= m_poSrcDS->GetRasterCount(); ++i)
{
int bHasVal = false;
const double dfVal = GetRasterBand(i)->GetScale(&bHasVal);
const double dfVal =
m_poSrcDS->GetRasterBand(i)->GetScale(&bHasVal);
oStep.aosArguments.AddNameValue(
CPLSPrintf("scale_%d", i),
CPLSPrintf("%.17g", bHasVal ? dfVal : 1.0));
Expand Down

0 comments on commit b1956fe

Please sign in to comment.