[GRASSLIST:4927] Re: read-write cells
Glynn Clements
glynn at gclements.plus.com
Tue Nov 23 19:09:49 EST 2004
Massimiliano Cannata wrote:
> When I open a new raster file (outfd=G_open_raster_new(pippo,pluto)) it
> is open only in writing or can I also read it?
No, it's write-only.
And you can't open the file for reading until you've finished writing
it, as the map won't exist (so far as G_open_cell_old() is concerned)
until you call G_close_cell().
> Let me explane, I change my active region, the first time I applay some
> calculations and write cell values, the next time my active region
> overlay the old one and I want to retrive the just written data cells....
> Is it done just using:
> G_get_raster_row(outfd,outrast,row,data_type) ?????
No. If you want to read the data which you've written, you'll have to
keep a copy of it.
Also, you need to be careful about changing the region settings while
writing to a file. The region settings which were in effect at the
time you called G_open_raster_new() determine how many rows and
columns you need to write.
This is different from reading, where each call to G_get_raster_row()
etc resamples the data according to the current region settings.
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-user
mailing list