d.what.v.pg [-sf] sql=file map=name [color=name]
[fillcolor=name]
[hv=name]
Parameters:
sql
tab is Postgres table containing column linked to vector attribute values, col - column associated with vector attribute values, map is name of an existing vector map with attribute values linked to the currently selected database.
Reports database attributes from the currently selected database which are associated with specific vector features identified using the mouse. 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. 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.
d.what.v.pg is used to query lines/areas with mouse. Like d.what.vect, it lists attributes and optionally fills queried areas (like v.area). It may be used for the UPDATE command in Postgres through the input SQL file (see Example 2). The idea is to prepare an arbitrary algorithm, code it in SQL, and then update DB with clicking on chosen polys/lines. You may consider this as piping through various filters anything you select on screen.
The database information can be optionally output as comma-separated
list (horizontal) which is convenient for feeding it to other programs
like table editors.
EXAMPLE:
1. d.what.v.pg -s sql=census.sql map=census
and census.sql is:
select slope, type_id from info_kuruma where rec_id = ?
Result: only two fields information is displayed on screen when the mouse is clicked upon the vector object.
2. d.what.v.pg -s sql=process.sql map=census
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 (the last limitation is a filter for any polygon/line picked from
the map with mouse) .
Flags: SQL select statements are input from a prepared file.
Parameters: SQL statements specifying well formed selection criteria. Name of an existing vector map.
This program requires the Postgres database software.
Postgres modifications: Janne Soimasuo, Faculty of Forestry, University of Joensuu, Finland.
Updated to GRASS 5 by Alex Shevlakov (sixote@yahoo.com)