[GRASSLIST:7995] Re: error reading large rasters in 5.4/6.0

Andrew Danner adanner at cs.duke.edu
Fri Aug 19 17:25:40 EDT 2005


On Fri, 2005-08-19 at 19:01 +0100, Glynn Clements wrote:
> Andrew Danner wrote:
> 
> > I'm having problems working with some large raster files in GRASS, even
> > though I have enabled large file support. 
> > 
> > 
> > I get the following problems:
> > 
> > 1) "r.info test" displays the wrong number of total cells. e.g., 
> 
> Right. Even if you enable large file support, many values are still
> limited to the range of a signed 32-bit integer (i.e. 2^31-1). This
> will start to manifest itself on maps with more than 2^31-1 cells;
> although most operations should still work, you will get oddities such
> as r.info displaying a negative cell count.
> 
> Unfortunately, this isn't likely to change any time soon; there are
> too many individual cases which would need to be changed.
> 

If there is an accepted way to fix this, I'll offer to patch up some of
the affected programs. r.info is an easy fix--one line in a printf. The
only issue is what is the most portable way to print a 64-bit int?

current:
sprintf (line, "  Total Cells:  %ld", (long)cellhd.rows * cellhd.cols);

my standard Linux way
sprintf (line, "  Total Cells:  %lld", ((off_t)cellhd.rows) *  
                                                   cellhd.cols);

A more portable way?
sprintf (line, "  Total Cells:  %" PRId64, (off_t)cellhd.rows) *  
                                                   cellhd.cols);

> > r.mapcalc test2=test 
> > ERROR: error reading compressed map [Neuse10] in mapset [local], row 0
> > 
> > The problem seems to be on rasters whose fcell file is bigger than 4GB. 
> 
> No idea on this. Unfortunately, I don't have 4GB of free disk space
> right now to test it.
> 

I'll look into this further..

-Andy




More information about the grass-user mailing list