[Qgis-developer] gdal provider changes data type in the absence of nodata value

Etienne Tourigny etourigny.dev at gmail.com
Wed Jun 20 08:08:00 PDT 2012


bump!  Anyone can comment on this?  Thanks

On Mon, Jun 18, 2012 at 5:03 PM, Etienne Tourigny
<etourigny.dev at gmail.com> wrote:
> A raster that does not contain a nodata value, a default value is
> selected that is outside of the range of the raster's data type.
>
> This is fine and a requirement for many operations, explained in
> gdaldataprovider.cpp
>
>      // But we need a null value in case of reprojection and BTW also for
>      // aligned margines
>
> However, the data type is changed (to include the new nodata value)
> which leads to unexpected results.
>
> For example, calling QgsContrastEnhancement::minimumValuePossible() on
> a raster with Byte data returns -32768 instead of 0.
> You can see the effect of this if you load a 1-band Byte raster and
> open the Layer Properties dialog (with no contrast enhancement),
> min/max values are -32768/32767 - but they should be 0/255
>
>
> Would it be possible to change this, perhaps adding a flag
> "mNoDataSet" like in the GDAL GTiff driver, and keep the out-of-range
> nodata value?
>
> Etienne


More information about the Qgis-developer mailing list