GRASS input/output drivers
In this package the I/O drivers for reading and writing GRASS raster maps are placed.
To better understand the code a good overview should be taken on the GRASS database-Location-Mapset structure, of which a short introduction is given below.
File structure of GRASS LocationA GRASS raster map consists of several files in several subdirectories in a mapset, organized as follows:
- cellhd/: map header including projection code, coordinates representing the spatial extent of the raster map, number of rows and columns, resolution, and information about map compression;
- cell/, fcell/ or grid3/: generic matrix of values in a compressed, portable format which depends on the raster data type (integer, floating point or 3D grid);
- hist/: history file which contains metadata such as the data source, the command that was used to generate the raster map, or other information provided by the user;
- cats/: optional category file which contains text or numeric labels assigned to the raster map categories;
- colr/: optional color table;
- cell_misc/: optional timestamp, range of values, quantization rules (for floating point maps) and null (no-data) files;
- WIND - contains the active processing region and the resolution
- PROJ_INFO - contains the information about the projection
- PROJ_UNITS - contains the information about projection units used
- cell, fcell - contain the raster files
- vector - contain the vector data since GRASS 6
- sites_list - contain the sites type data, deprecated from GRASS 6 on, but maintained in JGrass
The cell header file
A typical grass map header looks like the following:
e-w resol: 20
n-s resol: 20
Reclassified filesIf the first line reports 'reclass' then this file is a reclassified file and the original data file is given by the following two lines:
#1 5 3 8 .... ....
The color table file
Colortables for GRASS 5 and greater are supported.
The format of the color file, which is located in location/mapset/colr/mapname is the following:
The first line is a % character and two numbers indicating the minimum and maximum data values which have colors. Note that in JGrass after the range values we add a third value for alpha support.
After the first line, the list of color rules appears, that can be of the following formats:
value1:r:g:b value2:r:g:binterpolation of colors between the two values with the two colors
value1:r:g:bassumption that it means that value1 == value2
nv:r:g:bnovalues could also have color with such a rule.
Class Summary Class Description DummyProgressListenerA dummy progress listener. GrassBinaryImageReaderImageIO reader for the grass binary raster format. GrassBinaryImageWriter GrassCoverageReaderCoverage Reader class for reading GRASS raster maps. GrassCoverageReadParamRepresents the read parameters in the geotools space, as opposed to GrassBinaryImageReadParam that are for the imageio space. GrassCoverageWriterCoverage Writer class for writing GRASS raster maps. JGrassConstantsConstants used by the JGrass engine JGrassMapEnvironmentRepresents the structure around a map inside a grass database. JGrassRegionRepresents the geographic region used in the jGrass engines. JGrassUtilitiesA facade of often used methods by the JGrass engine