GRASS GIS 8 Programmer's Manual - GRASS GIS 8 Programmer's Manual
GRASS GIS 8 Programmer's Manual - GRASS GIS 8 Programmer's Manual
org
Libraries
Core libraries
(the name refers to the directory name in lib/ in the source code)
Further libraries
(the name refers to the directory name in lib/ in the source code)
Raster Libraries
• rst: GRASS Library for interpolation with regularized splines with tension
(library for interpolation with regularized splines with tension)
Vector Libraries
• btree: btree.h
• ogsf: GRASS GIS OGSF Library (OpenGL (R) ported gsurf library
(required for NVIZ))
• nviz: GRASS Nviz Library (used by wxGUI Nviz extension and CLI-based
Nviz module)
Python API
Projection Libraries
Miscellaneous Libraries
• add: lib/external/newlib
• add: lib/external/newlib/*.c
• add: lib/external/newlib/*.h
• add: lib/external/newlib/LICENSE
• add: lib/external/newlib/Makefile
• update: lib/external/Makefile
• update: lib/external/README.license
• update: lib/README.md
• update: include/Make/Install.make
• update: include/Make/Grass.make
• update: Makefile
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;
A GRASS vector maps are stored in several separate files in a single
directory (see GRASS Vector Library). While the attributes are stored in
either a DBF file, a SQLite file or in an external DBMS (PostgreSQL,
MySQL, ODBC), the geometric data are saved as follows:
head
vector map ASCII header with information about the map creation
(date and name), its scale and threshold;
coor
binary geometry file which includes the coordinates of graphic
elements (primitives) that define the vector feature;
topo
binary topology file describes the spatial relationships between the
map's graphic elements;
hist
history ASCII file with complete commands that were used to create
the vector map, as well as the name and date/time of the map
creation;
cidx
binary category index file which is used to link the vector object IDs to
the attribute table rows;
dbln
ASCII file which contains definition(s) of link to attribute storage in
database (DBMS).
Diagram of GRASS file structure
GRASS modules are compiled and installed using the UNIX make
command, which reads a file named Makefile (see Multiple-
Architecture Conventions for more information) and then runs the
compiler. The GRASS compilation process allows for multiple-
architecture compilation from a single copy of the source code (for
instance, if the source code is NFS mounted to various machines with
differing architectures). This chapter assumes that the programmer is
familiar with make and its accompanying Makefile.
./configure
make
make install
This will store the GRASS binaries into the directory "/opt/grass-7.x.y" and
the script mentioned above into "/usr/bin".
Todo:
Update the list.
• GISLIB - This names the GIS Library, which is the principal GRASS
library. See GRASS GIS General Library (aka GIS Library) for details
about this library, and Loading the GIS Library for a sample Makefile
which loads this library.
UNIX Libraries: The following variables name some useful UNIX system
libraries:
• MATHLIB - This names the math library. It should be used instead of the -
lm loader option.
Constructing a Makefile
target: dependencies
actions
more actions
If the target does not exist, or if any of the dependencies have a newer
date than the target (i.e., have changed), the actions will be executed to
build the target. The actions must be indented using a TAB. make is picky
about this. It does not like spaces in place of the TAB.
Multiple-Architecture Conventions
Object files and library archives are compiled into subdirectories that
represent the architecture that they were compiled on. These
subdirectories are created in the $SRC directory as OBJ.arch and
LIB.arch, where arch represents the architecture of the compiling
machine. Thus, for example, $SRC/OBJ.sun4 would contain the object
files for Sun/4 and SPARC architectures, and $SRC/LIB.686-pc-
linux-gnu would contain library archives for Linux architectures.
Likewise, $SRC/OBJ.686-pc-linux-gnu would contain the object
files for Linux architectures, and $SRC/LIB.686-pc-linux-gnu would
contain library archives for Linux architectures.
Note that 'arch' is defined for a specific architecture during setup and
compilation of GRASS, it is not limited to sun4 or any specific string.
Modules operation
Each module which modifies and writes data must read from input and
write to output so that data may not be lost. For example v.spag works
on map at in GRASS GIS 5.0 but if program (system) crashes or
threshold was specified incorrectly and vector was not backuped, data
were lost. In this case map option should be replaced by input and
output.
Modules parameters/flags
Flags:
Parameters: