On Tue, May 28, 2013 at 5:38 AM, Yann Chemin <[email protected]> wrote:
> Hi,
>
> is there a small way to open a new file and set all values to NULL?
> The function would be something like Rast_open_new_null(),
Using a module:
r.mapcalc "newmap = null()"
Using C code:
int row, nrows;
int data_type;
void *buf;
data_type = <one of CELL_TYPE, FCELL_TYPE, DCELL_TYPE>
/* open raster map ... */
buf = Rast_allocate_buf(data_type);
Rast_set_null_value(buf, Rast_window_cols(), data_type);
nrows = Rast_window_rows();
for (row = 0; row < nrows; row++) {
Rast_put_row(buf, data_type);
}
/* close raster map ... */
Markus M
_______________________________________________
grass-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-dev