NAME
d.what.r.pg - Report database attributes associated with
a raster category value at a specified location. (GRASS-RDBMS Attribute
Interface Program)
SYNOPSIS
d.what.r.pg
d.what.r.pg help
d.what.r.pg map=name tab=name col=name
[hv=name]
ALTERNATE
d.what.r.pg -s help
d.what.r.pg -s sql=filename map=name
DESCRIPTION
d.what.r.pg reports database attributes from the currently selected
database associated with a raster category at a specific location on a
raster map. The currently selected database is identified by the GRASS
environment variable $PG_DBASE which is set using the g.select.pg
GRASS-RDBMS interface tool. If this environment variable is not set the
program terminates with a message to the user. The current raster location
is selected by the user with the mouse. If the alternate form of this command
is selected with the -s flag the user has greater control over the
manner in which the attribute information is displayed. Using the -s
option the attributes from more than one table can be returned and displayed.
COMMAND LINE OPTIONS
Parameters:
-
map=map
-
Name of an existing raster map with category values linked to the currently
selected database.
-
tab=databasetablename
-
Table in the currently selected database containing a column associated
with raster category values.
-
col=databasecolumnname
-
Column associated with raster category values.
hv
-
Type of database output - [h/v]
-
default: h
ALTERNATE COMMAND LINE USAGE
The alternate command line usage is provided to simplify the process of
retrieving information from more than one table in the query criteria.
The alternate command line structure is selected using the the [-s]
flag on the command line. When using this flag the user must include the
name of a text file on the command line as well. This file must include
a complete, well formed SQL SELECT statement specifying the query criteria
needed to retrieve values which correspond to category values in a GRASS
data layer.
The user must also specify the name of the GRASS data layer containing
these category values on the command line. The following examples illustrate
the syntax which must be used in constructing a SELECT statement for use
with the -s flag.
EXAMPLE:
1. d.what.r.pg -s sql=raster.sql map=blag_forest_kur
and raster.sql is:
select rec_id, type_id from info_kuruma where type_id = ?
Result:
Reports two fields from the table info_kuruma associated with the raster
category value at the current mouse location the raster map.
2. d.what.r.pg -s sql=raster2.sql map=blag_forest_kur
and raster2.sql is:
select rec_id, type_id, census_info.type_good from info_kuruma where
type_id = ? and rec_id = census_info.rec_id
Result:
Reports fields from two tables info_kuruma and census_info associated
with the raster category value at the current mouse location the raster
map.
3. d.what.r.pg -s kur_rast_id sql=process.sql
process.sql is:
update census_info set type_good = '1' where rec_id = ? and info_kuruma.type_id
= 35 and info_kuruma.rec_id = rec_id;
Result: this would only change field of the census_info table
for the clicked polygon or line,
if the corresponding type taken from info_kuruma table is equal
to 35.
Flag:
-
-s
-
SQL select statements are input from a prepared file.
Parameters:
-
sql=filename
-
SQL statements specifying well formed selection criteria.
-
map=map
-
Name of an existing raster map with category values linked to a database.
hv
-
Type of database output - [h/v]
-
default: h
-
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.s.pg,
d.what.v.pg,
r.reclass.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)