r.reclass.pg

NAME

r.reclass.pg - Generate a new raster reclass map based on the results of multiple queries to the currently selected database. (GRASS-RDBMS Raster Interface Program)

SYNOPSIS

r.reclass.pg
r.reclass.pg help
r.reclass.pg sql=file input=name key=name output=name [label=name]

DESCRIPTION

r.reclass.pg generates reclass rules for a new raster map layer based on the results of multiple queries to the currently selected database. The user constructs a series of mutually exclusive SQL retrieve statments designed to return groups of records from the database. Each group of records should be interanally consistent in terms of attribute characteristics specified by the user in the retrieve clause. These groups should also be mutually exclusive, thereby insuring that a row returned by one retrieve clause is not also returned by a subsequent retrieve clause. Each group of records therefore forms the basis for a single category in the resulting GRASS raster reclass map. r.reclass.pg processes each retrieve statement in order generating the GRASS reclass rules needed to create a new raster map. As each retrieve statment is processed the group of records returned receives a common category value. The category value is incremented by one for each subsequent retrieve statment which is processed. The resulting reclass map will have one category for each of the original retrieve statements and an additional category for no data areas. No data in this case includes actual no data areas and areas for which no rows were returned by the database queries.

COMMAND LINE OPTIONS

Parameters:

sql=filename
Name of file containing SQL query statements.

input=map
Name of an existing raster map layer.

key=databasecolumnname
Name of the database column linked to GRASS via the categories in the input map layer.

output=map
Name of new raster (reclass), file.

label=name
Label for new categories.

EXAMPLE:

r.reclass.pg sql=dbrr.sql key=grasscat input=seco.soils output=tfact.recl label="Tfact="

dbrr.sql:
retrieve (secosoilcats.grasscat)
where layer.tfact >0 and layer.tfact <=2 and layer.muid=secosoilcats.muid

retrieve (secosoilcats.grasscat)
where layer.tfact >0 and layer.tfact <=2 and layer.muid=secosoilcats.muid

retrieve (secosoilcats.grasscat)
where layer.tfact = 5 and layer.muid=secosoilcats.muid

BUGS

None known.

NOTE

This program requires the Postgres database software.

SEE ALSO

g.column.pg, g.select.pg, g.stats.pg, g.table.pg, d.rast.pg, d.site.pg, d.vect.pg, d.what.r.pg, d.what.s.pg, d.what.v.pg, r.rescale.pg, v.reclass.pg

AUTHOR

Original Informix SQL-tools: James A. Farley, Wang Song, and W. Fredrick Limp University of Arkansas, CAST

Postgres modifications: Janne Soimasuo, Faculty of Forestry, University of Joensuu, Finland.

Updated to GRASS 5 by Alex Shevlakov (sixote@yahoo.com)