[GRASS5] libgis raster reading

Glynn Clements glynn.clements at virgin.net
Tue Mar 30 15:17:16 EST 2004


Andrea Antonello wrote:

> I need to understand how GRASS reads and writes the raster data from disk. The 
> developer Manual doesn't go much into detail and I'm having big problems to 
> get lost inside the code... 

No surprise there. I probably understand that code as well as any of
the current developers, and I also get lost inside the code.

FWIW, the relevant files are opencell.c, get_row.c, put_row.c and
closecell.c, all in src/libes/gis.

> Any hint on used algorithms (LZW?)

LZW was used at one point, but isn't supported in 5.x. Integer maps
are stored in big-endian order using a sign bit (*not* twos
complement), with optional run-length compression; floating-point maps
are encoded using XDR and optional zlib (gzip) compression.

The core functions for writing are put_data/put_fp_data. For reading,
there aren't really any core functions; the process seems to be evenly
distributed across most of get_row.c.

> or documentation parts I missed are appreciated.

AFAIK, the only viable source of information on the raster map formats
is the source code.

> PS: is there some project ongoing that aims to rewrite the raster I/O libs in 
> any programming language?

I'll probably do it one day, unless someone else gets there first. 

-- 
Glynn Clements <glynn.clements at virgin.net>




More information about the grass-dev mailing list