Code for reading entire raster maps

Bill Brown brown at cecer.army.mil
Fri May 15 11:42:54 EDT 1998


If you're using GRASS 4.1, this will work:

    if ((elev_fd = G_open_cell_old(elev, elev_map)) == -1)
    {
        sprintf(buff,"Not able to open cellfile for [%s]", elev);
        G_fatal_error(buff);
    }

    size = wind.rows * wind.cols;
    elev_buf = (CELL *)G_malloc (size * sizeof (CELL));

    for (row = 0; row < wind.rows ; row++) {
        G_get_map_row(elev_fd, &(elev_buf[row * wind.cols]), row) ;
    }
    G_close_cell(elev_cell);



More information about the grass-user mailing list