d.what.v.pg

NAME

d.what.v.pg - Report database attributes associated with vector features.

SYNOPSIS

d.what.v.pg
d.what.v.pg help
d.what.v.pg tab=name col=name map=name [join=tab,tabkey,pkey]

ALTERNATE

d.what.v.pg -s help
d.what.v.pg -s pql=filename map=name

DESCRIPTION

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 $PGDBASE 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 no join parameters are provided by the user on the command line the attributes in the table directly linked to the GRASS raster structure via the category value are returned. However, if a join is specified then attributes from a related table are displayed. If the alternate form of this command is selected with the -s flag the user has greater control over the number of relational joins and 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.

Parameters:

Table containing column linked to vector attribute values. Column associated with vector attribute values. Name of an existing vector map with attribute values linked to the cur­ rently selected database. Tab is the table used to develop the current postQUEL query. Tabkey is the database column used to relate information in this table with data in the table linked to the GRASS category file. Pkey is the associated column in the table linked to the GRASS category file which is related to tabkey in the current table.

For instance, assume that feature is a table containing column values associated with category values in a GRASS vector file (recordnum). In addition, assume that cfcclookup is a table containing attribute data on the transportation network in the same area. In this example cfcclookup.cfcc is the column linking the table cfcclookup to the table feature via feature.cfcc. To specify a query based on attribute values in the table cfcclookup the join statement would be:

join=cfcclookup,cfcclookup.cfcc,feature.cfcc

Specifying these conditions would insure that all rows from table cfcclookup which satisfy the query criteria would be matched with the corresponding rows in table feature, which are then related to the spatial features in the GRASS data layer via the database column feature.recordnum which is related to the GRASS category values.

This syntax is adequate to accomplish 2 table joins. However, if the query demands joins between more than 2 tables it is advisable to use the -s option [see Alternate Command Line Usage] to read a user prepared query, complete with join requirements, from a file. 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 postQUEL retrieve statement specifying the query criteria and all relevant JOINS 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 example illustrates the syntax which must be used in constructing a retrieve statement for use with the -s flag.

d.what.v.pg -s pql=census.pql map=census

census.pql:
retrieve unique (cfccatts.all)
where cfccatts.tlid=?

Result: Reports all attributes from table cfccatts associated with the vector at current mouse location.

EXAMPLE

d.what.v.pg -s pql=census.pql map=census

census.pql:
retrieve unique (cfccatts.all, cfcc.all)
where cfccatts.tlid = ? and cfccatts.cfcode=cfcc.cfcode

Result: Reports all attributes from tables cfccatts and cfcc associated with the vector at current mouse location.

Flags: postQUEL select statements are input from a prepared file.

Parameters: postQUEL statements specifying well formed selection criteria. Name of an existing vector map.

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, 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)