NAME

d.vect.pg - Display select vectors from an existing vector map. (GRASS-RDBMS Interface Display Program)

SYNOPSIS

d.vect.pg
d.vect.pg help
d.vect.pg [-f] key=name tab=name [where=name] map=name [color=name]

ALTERNATE

d.vect.pg -s help
d.vect.pg -s sql=filename map=name [color=name]

DESCRIPTION

d.vect.pg displays select vectors from an existing vector map based on the unique values in a database column. Each row returned by a user constructed database query will be associated with a vector feature which is subsequently drawn on the graphics display in the active frame. The user can control the color of the vector draw by specifying a color on the command line.

COMMAND LINE OPTIONS

Flag:

-f
Fill polygons selected on the query criteria

Parameters:

key=databasecolumnname
Column in table "tab" of the currently selected database containing values corresponding to the vector maps category values. Table is designated on the command line by tab=tablename and vector is designated on the command line by map=mapname.
tab=databasetablename
Table in the currently selected database containing a column which has values corresponding to vector category values in the map designated by map=map.
where=SQLwhereclause
SQL "where" clause which specifies the query criteria to be used in subsetting the database. The field names specified in the where option must indicate the column(s) to be used, the operators to be used in the evaluation and the values which the data in the column will be evaluated against.
If the database column used as the selection criteria is a character field then the associated value must be placed in quotes. To determine the data types associated with columns in the currently selected database use the g.column.pg command with the -v flag.

Queries which are more complex are best implemented using the -s flag and a prepared SQL file.

map=map
Name of an existing vector map with category values which correspond to values in a specified column in the currently selected database.
color=name
Color to draw vectors in
Colors: red, orange, yellow, green, blue, indigo, violet, magenta, brown, gray, white, black

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 to retrieve values which correspond to category values in a GRASS data layer.

Flag:

-s
SQL select statements are input from a prepared file
-f
Fill polygons selected on the query criteria

Parameters:

sql=filename
SQL statements specifying well formed selection criteria.
map=name
Name of an existing vector map
color=name
Color to draw vectors in
Colors: red, orange, yellow, green, blue, indigo, violet, magenta, brown, gray, white, black


EXAMPLE:

1. d.vect.pg -f key=rec_id map=kuruma_id tab=info_kuruma where='type_id >32 and type_id < 38'  color=red
 

Result: only polygons with type in 33-37 range would be displayed in red color..

2. d.vect.pg -f -s sql=oak.sql map=kuruma_id

oak.sql is:

select rec_id from info_kuruma where type_id > 32 and type_id <38;

Result: this would be the same as in the first example.

BUGS

none

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.what.r.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)