#6519 closed defect (fixed)
contour generation does not handle NaN as nodata correctly
Reported by: | dsogari | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | 2.1.1 |
Component: | Algorithms | Version: | 2.1.0 |
Severity: | normal | Keywords: | contour nodata nan |
Cc: |
Description
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
Attachments (4)
Change History (7)
by , 8 years ago
Attachment: | contour_modif.cpp added |
---|
comment:3 by , 8 years ago
Component: | default → Algorithms |
---|---|
Milestone: | → 2.1.1 |
modified contour.cpp