#6467 closed defect (fixed)

NaN values not being parsed in gdal_rasterize options

Reported by: dsogari Owned by: warmerdam
Priority: normal Milestone: 2.0.3
Component: default Version: svn-trunk
Severity: normal Keywords: gdal_rasterize nan
Cc:

Description

The gdal_rasterize app currently does not handle NaN values for the "-init" and "-burn" options, because of the implementation of the ArgIsNumeric? function in gdal_rasterize_lib.cpp::47

If we supply such value, ArgIsNumeric? gives false and the 'i' is not incremented when reading either the "-init" or "-burn" options, causing the app to fail in the next iteration.

I propose the following modification: where it reads

   return CPLGetValueType(pszArg) != CPL_VALUE_STRING;

it could be written

   return CPLIsNan(CPLAtof(pszArg)) ||
       CPLGetValueType(pszArg) != CPL_VALUE_STRING;

A patch file is attached for convenience. Thanks

Attachments (1)

gdal_rasterize_lib.patch (462 bytes) - added by dsogari 11 months ago.
patch file for gdal_rasterize_lib.cpp

Download all attachments as: .zip

Change History (2)

Changed 11 months ago by dsogari

Attachment: gdal_rasterize_lib.patch added

patch file for gdal_rasterize_lib.cpp

comment:1 Changed 11 months ago by Even Rouault

Milestone: 2.0.3
Resolution: fixed
Status: newclosed

trunk r34043, branches/2.1 r34044 (post 2.1.0RC1), branches/2.0 r34045 "gdal_rasterize: accept NaN as a valid value for -init / -burn (derived from patch by dsogari, #6467)"

Note: See TracTickets for help on using tickets.