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

Colin Nielsen colin.nielsen at gmail.com
Fri Jun 27 03:41:36 EDT 2008


Thank you so much Glynn, that fixed it exactly. I left out that
element when I converted from CELL to DCELL. Too bad I wasn't trying
to read data from the first column or I might have noticed.

-Colin

On Thu, Jun 26, 2008 at 7:30 PM, Glynn Clements
<glynn at gclements.plus.com> wrote:
>
> 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