[GRASS-dev] How to read a raster cell value?

Glynn Clements glynn at gclements.plus.com
Thu Jun 26 14:30:53 EDT 2008


Colin Nielsen wrote:

> As far as I can tell I have set the dir_fd file up to be full of double values:

> 	    for (i = 0; i < nrows; i++) {
> 	    	G_get_d_raster_row(dir_id, dir_buf, i);
> 	    	//get_row(dir_id, dir_buf, i);
> 	    	write(dir_fd, dir_buf, sizeof(DCELL));

You are writing *one* DCELL value for each row. That should probably
be something like:

 	    	write(dir_fd, dir_buf, ncols * sizeof(DCELL));

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list