[GRASS5] Re: [GRASSLIST:5080] Re: r3out.v5d(?) problem

Glynn Clements glynn.clements at virgin.net
Wed Nov 27 05:47:20 EST 2002

Markus Neteler wrote:

> r3.mapcalc	someone is re-writing r.mapcalc (sorry, I don't remember the
> 		name) and could be a good idea to introduce the news in the
> 		3D version. I don't now anything about the changing on
> 		r.mapcalc; add the possibility to have absolute reference to
> 		the cells and not only relative;
> 		find out why the module crashes when the number of
> 		levels is increased over a certain value;
> 		add the possibility to use 2D maps 
> 		question/suggestion: could be an idea to have only one 
> 		r.mapcalc able to work with 2D and 3D rasters?

Sharing the code would be preferable to having two distinct programs
which contain a lot of duplicate code. However, making r.mapcalc
handle 3D rasters would require that the G3D library had been built
prior to compiling r.mapcalc (currently it is disabled). Also, it's
only worth the effort if G3D is going to be "undeprecated".

AFAICT, the changes required are:

1. Use G3d_* functions for reading and writing maps (both the raster
data and support files, e.g. colour tables, categories).

2. Use G3d_* functions for reading the window.

3. Extend the parser to allow 3D offsets, e.g. "map[x,y,z]".

4. Add z(), depth() and tbres() functions, analogous to x/y, col/row,
ewres/nsres respectively.

5. Extend the top-level to iterate over depths as well as rows.

Most of the effort would be in learning the G3D API for 1 and 2; I
suspect that the actual changes would all be trivial.

Glynn Clements <glynn.clements at virgin.net>

More information about the grass-dev mailing list