[Qgis-developer] Re: Raster providers

Marco Hugentobler marco.hugentobler at sourcepole.ch
Mon Jan 17 04:06:11 EST 2011


Hi Radim

Using NaN sounds like a good idea and Qt has platform independent support for 
it (qIsNan & co.).
All other solutions I can think of seem to be more complicated (e.g. force a 
transparency value only if raster is reprojected).

>float + NaN for byte/int?

This is not clear to me. Could you explain your approach for byte/int?

Regards,
Marco



Am Sonntag, 16. Januar 2011, um 13.29:56 schrieb Radim Blazek:
> Or we can just use NaN for float/double and float + NaN for byte/int?
> 
> Radim
> 
> On Sun, Jan 16, 2011 at 11:29 AM, Radim Blazek <radim.blazek at gmail.com> 
wrote:
> > On Thu, Jan 13, 2011 at 9:04 AM, Marco Hugentobler
> > 
> > <marco.hugentobler at sourcepole.ch> wrote:
> >> With one of my favorite test dataset, I noted a problem with automatic
> >> assignment of nodata value and automatic insertion into the transparency
> >> list. In that case, the raster is a colortable map (byte) and has no
> >> nodata value. So 255 is set to transparent and the map appears
> >> completely different than expected...
> > 
> > The problem is that with reprojection we always need null values even
> > if not defined by raster. At moment I just assigned the max value for
> > each data type which is obviously wrong as you proved.
> > The question is how to passed null values from provider to raster
> > layer. We could:
> > 
> > 1) scan all values for a not used value, but it can slow down first
> > loading and it is not always successful (for short data types all
> > values may be occupied)
> > 
> > 2) always use longer data type (int for byte, float for int etc), the
> > bigger size probably is not problem because we usually need only a
> > block of data for screen (for double it is max around 1600*1200*8 =
> > 14MB), but what about Float64 - could/should we use long double, it
> > can be 96 or 128 bits and not available on ARM(?) etc...
> > 
> > 3) probably the right solution would be to use separate bit matrix as
> > null flags, but that would complicate too much the implementation
> > 
> > Maybe a combination of 1+ 2? 1 for shorter types - byte/int and 2 for
> > float/double? How to find quickly a not used value?
> > 
> > I am waiting for your ideas.
> > Radim


-- 
Dr. Marco Hugentobler
Sourcepole -  Linux & Open Source Solutions
Churerstrasse 22, CH-8808 Pfäffikon SZ, Switzerland
marco.hugentobler at sourcepole.ch http://www.sourcepole.ch
Technical Advisor QGIS Project Steering Committee


More information about the Qgis-developer mailing list