FREC 682 Spatial Analysis

course syllabus


GRASS Data Structures: the Gory Details

To review, GRASS is a set of separate modules operating within a specific environment. The GRASS prompt GRASS4.1> is transparent to UNIX, and merely signifies that the necessary global environment variables have been set to run GRASS modules. All standard UNIX functions are available at the GRASS prompt.

GRASS raster and vector files are actually multiple files in separate subdirectories within your mapset. The entire GRASS database structure begins with the GRASS database /home/strauss/usrb/grass.data. This includes several subdirectory locations. When you start a GRASS session in a location, GRASS creates a mapset subdirectory for you under that location.

One of the big advantages of GRASS is that its data structures are all open, meaning that you can mess around with the data at any level you like. You can edit individual vector feature vertices or raster header data with a text editor. (Just be sure you know what you're doing!)

Your mapset has multiple subdirectories containing component files for raster, vector and site maps. These are created by GRASS as needed. Complete information on GRASS data structures is available in the GRASS Programmer's Guide. The basics are summarized here.

Raster Data Structures

Raster maps have as many as 7 component files in the following subdirectories:

Vector Data Structures

Vector maps have as many as 6 component files in the following directories:

Sites (Point Feature) Data Structure

Sites maps require only a single file in the site_lists directory. A sites file has two header lines followed by a line for each site specifying easting and northing coordinates and the site name or attribute value, e.g.:

name|archsites
desc|Potential historic and archealogical sites
593493|4914730|1 Signature Rock
591950|4923000|2 No Name
589860|4922000|3 Canyon Station
590400|4922820|4 Spearfish Creek
....

The "|" character is default field separator in a site_lists file.

Basic File Management Modules

The GRASS file management modules g.copy, g.rename, g.remove handle all component files for raster and vector maps simultaneously. It is generally more efficient to use these modules than the UNIX cp, mv or rm commands.

g.mapsets accesses (read-only) others' mapsets.

g.list displays contents of your and other accessed mapsets.

g.access changes permissions on your own mapset.



course syllabus