[GRASS-dev] Rast_open_new_null()
Markus Metz
markus.metz.giswork at gmail.com
Tue May 28 11:27:41 PDT 2013
On Tue, May 28, 2013 at 5:38 AM, Yann Chemin <ychemin at gmail.com> 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
More information about the grass-dev
mailing list