Bas Couwenberg pushed to branch upstream at Debian GIS Project / gdal
Commits: 67516919 by Bas Couwenberg at 2025-07-09T05:22:16+02:00 New upstream version 3.11.2~rc2+dfsg - - - - - 2 changed files: - NEWS.md - apps/gdallocationinfo.cpp Changes: ===================================== NEWS.md ===================================== @@ -26,6 +26,7 @@ GDAL 3.11.2 is a bugfix release. ### Raster utilities * gdalwarp: fix reprojecting to COG (3.11.0 regression) +* gdallocationinfo: handle properly nodata values (3.10.0 regression fix) ### Raster drivers ===================================== apps/gdallocationinfo.cpp ===================================== @@ -577,11 +577,25 @@ MAIN_START(argc, argv) const bool bIsComplex = CPL_TO_BOOL( GDALDataTypeIsComplex(GDALGetRasterDataType(hBand))); - CPLErr err; - err = GDALRasterInterpolateAtPoint(hBand, dfPixelToQuery, - dfLineToQuery, eInterpolation, - &adfPixel[0], &adfPixel[1]); - + CPLErrorReset(); + CPLErr err = GDALRasterInterpolateAtPoint( + hBand, dfPixelToQuery, dfLineToQuery, eInterpolation, + &adfPixel[0], &adfPixel[1]); + + // GDALRasterInterpolateAtPoint() returns false on nodata + bool bIsNoData = false; + if (err != CE_None && CPLGetLastErrorType() == CE_None) + { + int bHasNoData = FALSE; + const double dfNoData = + GDALGetRasterNoDataValue(hBand, &bHasNoData); + if (bHasNoData) + { + bIsNoData = true; + adfPixel[0] = adfPixel[1] = dfNoData; + err = CE_None; + } + } if (err == CE_None) { CPLString osValue; @@ -628,7 +642,7 @@ MAIN_START(argc, argv) "Unable to get raster scale." ); } #endif - if (dfOffset != 0.0 || dfScale != 1.0) + if (!bIsNoData && (dfOffset != 0.0 || dfScale != 1.0)) { adfPixel[0] = adfPixel[0] * dfScale + dfOffset; @@ -651,7 +665,19 @@ MAIN_START(argc, argv) printf(" Descaled Value: %s\n", osValue.c_str()); } } - + else + { + nRetCode = 1; + if (bAsXML) + { + osXML += "<IOError/>"; + } + else if (bValOnly) + { + if (i > 0) + printf("%s", osFieldSep.c_str()); + } + } if (bAsXML) osXML += "</BandReport>"; } View it on GitLab: https://salsa.debian.org/debian-gis-team/gdal/-/commit/67516919a8d7637795543b5855491cab7bb53671 -- View it on GitLab: https://salsa.debian.org/debian-gis-team/gdal/-/commit/67516919a8d7637795543b5855491cab7bb53671 You're receiving this email because of your account on salsa.debian.org.
_______________________________________________ Pkg-grass-devel mailing list Pkg-grass-devel@alioth-lists.debian.net https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-grass-devel