[gdal-dev] Two questions about gdal_contour

Even Rouault even.rouault at spatialys.com
Thu Dec 13 05:57:54 PST 2018


On jeudi 13 décembre 2018 13:37:56 CET Rahkonen Jukka (MML) wrote:
> Hi,
> 
> I noticed this question in gis.stackexchange
> https://gis.stackexchange.com/questions/305641/gdal-doesnt-create-contours-> for-the-whole-raster?noredirect=1#comment493737_305641 and now I wonder
> 
> 
> 1)      If gdalinfo reports NoData Value=3.4028234663852886e+38, why
> gdal_contour does not accept the value as -snodata 

gdal_contour accepts it for me as a valid argument (in master). But I've not 
verified if comparison against it worked as intended in the gdal_contour 
context. If it does exact comparisons or comparisons against a fixed 
threshold, then due to decimal approximation, the chance that the comparison 
does not work as expected is high.

> but user needs to know
> to use "inf"?

inf is not the same as 3.4028234663852886e+38. 3.4028234663852886e+38 is the 
largest float32 value that is not infinity. But it is very easy to go just 
above it (due to decimal rounding issues, float32 vs float64 conversions, 
etc), and thus be considered at infinity. I did related fixes in GDAL core and 
VRT driver recently, but they likely don't fix any gdal_contour specific 
issue.

> 
> 2)      If user asks gdal_contour to create intervals of 1 m from 20 to
> 3.4028234663852886e+38, wouldn't it be better to ask "Are you sure?" or
> error out before starting a process that will for sure fail? I guess that
> in most cases users do not really want more than 1000 contour levels.

Dealing with all possible situations where the user might ask crazy things is 
a never ending task...

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list