[GRASSLIST:300] Re: Reduction of raster filesize by subsectioning into smaller maps?

Hamish hamish_nospam at yahoo.com
Tue Mar 21 21:24:21 EST 2006


> Ok, I'll try to explain what I mean. I have certain bathyemtry rasters
> that are pretty unusual in shape - see attached - this map pretty much
> maximizes the null/data ratio for the given region which completely
> encloses it's shape. So I have a couple questions:

Note CELL maps will be smaller than FCELL maps, which will be smaller
than DCELL maps. (ie int,float,double)

Glynn may correct me here, but IIRC, CELL maps with negative values will
be a fair size bigger than CELL maps without negative values, which is
something to consider when storing bathymetry data. By multiplying by -1
in r.mapcalc you may make the stored map size much smaller. This isn't
the case for FCELL & DCELL.

> I actually just developed a script that does this quite nicely already
> - the user enters the number of rows and columns to section a raster
> into, then interates through the raster, moving an r.mapcalc window
> through the sectioned grid making a new map for each tile. A cool
> option I through in was to accept a threshold percentage of null
> values that a candidate map can have; if the region inside the current
> window has more than the cutoff threshold, then this section is not
> exported, and the window moves on. But if I can't get any savings in
> filesize by rejecting mostly null tiles, then I'm not sure how useful
> this feature might be. 

alt: write a script to save the region details (write a world file),
r.to.vect the cells, save only the non-null cells and maybe export to a
text file for gzipping. reverse to recover.

alt2: r.out.ascii or r.out.bin and Bzip2

It's just a matter of what's the least work I think.


> Do you guys think that this would be useful functionality for the
> Add-ons?

that's your call. If it works and is useful for you, it'll probably be
useful to someone else out there as well...


Hamish




More information about the grass-user mailing list