diff --git a/alg/gdalwarper.h b/alg/gdalwarper.h index 15eceb561022..f3dd6408d011 100644 --- a/alg/gdalwarper.h +++ b/alg/gdalwarper.h @@ -463,6 +463,8 @@ class CPL_DLL GDALWarpKernel GWKTieStrategy eTieStrategy; + bool bWarnedAboutDstNoDataReplacement = false; + /*! @endcond */ GDALWarpKernel(); diff --git a/alg/gdalwarpkernel.cpp b/alg/gdalwarpkernel.cpp index 911a620e629f..527c15580e51 100644 --- a/alg/gdalwarpkernel.cpp +++ b/alg/gdalwarpkernel.cpp @@ -1561,6 +1561,19 @@ inline void AvoidNoData(const GDALWarpKernel *poWK, int iBand, pDst[iDstOffset], std::numeric_limits::max()); } } + + if (!poWK->bWarnedAboutDstNoDataReplacement) + { + const_cast(poWK) + ->bWarnedAboutDstNoDataReplacement = true; + CPLError(CE_Warning, CPLE_AppDefined, + "Value %g in the source dataset has been changed to %g " + "in the destination dataset to avoid being treated as " + "NoData. To avoid this, select a different NoData value " + "for the destination dataset.", + poWK->padfDstNoDataReal[iBand], + static_cast(pDst[iDstOffset])); + } } }