[GRASS5] FCELL color problem

Markus Neteler neteler at itc.it
Tue Mar 5 04:27:14 EST 2002


On Fri, Mar 01, 2002 at 10:20:11PM +0000, Glynn Clements wrote:
> 
> Markus Neteler wrote:
> 
> > today my colleage Lorenzo Potrich discovered a color
> > problem with FCELL data (INT and DCELL are o.k.).
> > 
> > The problem is a different behaviour between d.rast
> > and d.his. When overlaying FCELL raster polygons without own
> > color table (maybe also with, not tried) to a shade
> > map, one polgygon *disappears*.
> >  
> > This works o.k. for INT and DCELL. Maybe someone else
> > can try (and hopefully fix, I assume a color index problem).
> 
> Actually, it doesn't appear to be FCELL vs DCELL, but due to the fact
> that the FCELL map has a range of 1.0-2.5 while the DCELL map has a
> range of 0.0-3.0.

Sorry for this confusion, I tried to replicate a portion from
our database.
 
> The problem is that G_get_c_raster_row() is rounding the FCELL value
> to the nearest integer. For the red polygon, the value is being
> rounded from 2.5 to 3, which is beyond the end of the colour table.
> 
> The obvious fix is not to coerce the data to CELL type. This seems to
> be a situation where it initially appeared that the program didn't
> need to be changed with the introduction of FP support, but it turns
> out not to be so.
> 
> I've changed d.his to use G_get_raster_row_colors(), which combines
> G_get_raster_row() with G_lookup_raster_colors(), using the map's
> native type (CELL/FCELL/DCELL) for the intermediate buffer.
> 
> This also fixes the problem with d.his changing the colours of the
> DCELL version.

Now it is all well. Thanks for fixing it!

 Markus



More information about the grass-dev mailing list