[GRASS5] r.neighbors: works with reclass maps?

Glynn Clements glynn.clements at virgin.net
Fri Jan 4 17:21:35 EST 2002


Glynn Clements wrote:

> I've tracked this down to the double use of a static buffer
> (G__.mask_buf) in G_get_raster_row().

That was a problem, but it turns out not to have been the only one. 

Both G_get_raster_row() and G_get_raster_row_nomask() had the
following:

     for(i=0; i<WINDOW.cols; i++)
	G_set_raster_value_c(rast, G__.mask_buf[i], data_type);

This explains why only the first cell in the row was non-null. I have
changed it to:

     int size = G_raster_size(data_type);
     ...
     for(i=0; i<WINDOW.cols; i++)
     {
	G_set_raster_value_c(rast, G__.temp_buf[i], data_type);
	rast = G_incr_void_ptr(rast, size);
     }

G_get_[fd]_raster_row[_nomask] should now work for reclass maps.

BTW, you need to rebuild everything if you update, as the layout of
"struct G__" has changed.

-- 
Glynn Clements <glynn.clements at virgin.net>



More information about the grass-dev mailing list