contour generation does not handle NaN as nodata correctly
|Reported by:||dsogari||Owned by:||warmerdam|
|Severity:||normal||Keywords:||contour nodata nan|
The code of GDALContourGenerate in alg/contour.cpp does not take care of NaN as the nodata value. If the gdal_contour utility is applied to two equivalent datasets, but one using normal number as nodata and the other using NaN, then the resulting contours are different.
The difference appears in the transition from valid pixels to nodata pixels, where, in the NaN version, the contour lines are cut short (they do not touch the valid pixel boundary).
I tried modifying the code to handle the case for NaNs and it gave the expected result, so I'm sharing it with you. I'm not shure whether the fixes are 100% ok, though.
The modified contour.cpp is attached, as well as a patch file and two sample rasters for testing. I appreciate any feedback. Thanks