GDBase

DATA FILES

Database files are stored in a user's GRASS location just as other map
files are, under a "dbase" directory.  Database files consist of two
header lines followed by data records.  Each record is one line, with
colons separating the fields.  The first header line describes which
the map files (raster, vector, or sites) the database can be used
with.  The second header line is the field names separated by colons.
Each record will store field values in the exact order of the field
names of the header.  In effect, the second header line contains the
column titles, and the records contain the column values.  Field values
can contain spaces, and most other characters but not "*" or ":".
Fields can be words or numbers.  The first field MUST be the attribute
number.  It is recommended that the second field be the category name.

An example database file might look like:

	raster and vector files wetlands@PERMANENT 
	att:cat:type:county
	1:Big Marsh:tidal:Sacramento 
	2:Small Marsh:tidal:San Joaquin
	3:River Strip:riparian:Sacramento


GDBASE QUERY RULES

GDBase currently supports the creation of two types of reclass.  The
first reclass is based on query matching, such as "wetlands = tidal."
The second reclass type is based on unique combinations of selected
fields.  For instance "county" would aggregate all units by county.
The third analysis type is display.  This creates a temporary reclass
(by query matching) and overlays it onto the current display monitor.

Query rules files have two formats, depending on the analysis type.
For unique reclasses, a query rules file will be one line, with all
field names to be used separated by spaces.  If the word "ALL" is
included in the file, then all fields will be used for the unique
determinations.

For query matching reclasses, the rules file length is dependent on the
number of new categories.  For each new category in the output file,
three lines are required in the rules file.  The first line is the new
attribute number to be assigned to areas matching the query rule, the
second line is the category name to be assigned, and the third line is
the query rule itself.  The number of blank lines between each triplet
is irrelevant.  But a return (newline character) must be present at the
end of the last line.  When in doubt add a blank line at the bottom.
Non-numeric field values should be enclosed in quotes.  The "*"
character is a wildcard, representing any number of any characters.
The asterix SHOULD be included within the quotes.

For example, a query rules file might look like:

	1 
	tidal wetlands 
	type = "tidal"

	2 
	riparian corridors 
	type = "riparian"



USING GDBASE INTERACTIVELY

To use GDBase interactively, simply type one of the gdbase commands:
r.gdbase, v.gdbase or s.gdbase.  The first window is to select the
analysis type.  Choose one of the three types (reclass, display or
unique).  If you already have a database query file you would like to
use or update, enter it in the space given.  Clicking on the "Run
GDBase" button will bring you to the next window.

The second window is for actually creating the query rules and
selecting your input and output files.  You will need to specify a
database file, an input file to be reclassed and, with the exception of
diplay, a new reclass file name.  By double clicking on a mapset, in
the upper left box, you can display the available databases and maps in
that mapset.  Double clicking on a database or map will select them for
input.  You may also specify a file name for saving the query rules you
develop in a session.

Double clicking on the database will also bring up the available field
names in the lower left box.  Double clicking on a field name will do
two things.  First it will add that field name to you query rule in the
lower right, and it will bring up a list of possible field values.
Double clicking on either a field value or an operator will also append
that selection to your query rule.  The rule can be edited directly
from the keyboard as well.  For each rule, a new attribute number and
category name should also be specified in the appropriate boxes.

When you have created a rule, press "Next Rule" to load that rule and
clear the screen for the next rule.  You can also step backwards and
forwards through your rules with the "Review Rule" and "Next Rule"
buttons.  "Clear Rule" will erase the attribute, category and query
rule for the current rule.  Finally, "Run GDBase" will query the
database and create the reclass file.


USING GDBASE NONINTERACTIVELY

To use GDBase on the commandline, you need to create a rules file.
Then run the appropriate gdbase command (r.gdbase, v.gdbase, or
s.gdbase) followed by five arguments.

	input=filename  - the map to be reclassed 
	output=filename - the new reclass map (for unique and reclass) 
	database=filename - the existing database file 
	rules=filename - the query rules file 
	analysis=[reclass | display | unique ]

The first letter of the argument may be substituted for the word.  For
example:
	r.gdbase i=wetlands o=wetlands.new d=wetlands r=wettypes
	a=reclass

