d.site.pg
NAME
d.site.pg - Display select sites from a database query.
(GRASS-RDBMS Interface Display Program)
SYNOPSIS
d.site.pg
d.site.pg help
d.site.pg [sql=filename]
[table=name]
[coordx=X-column]
[coordy=Y-column]
[where=conditions]
[map=name]
[plot=color,icon,size]
DESCRIPTION
d.site.pg displays selected point locations returned from a database query.
The site locations returned from the database query are displayed as icons in
the active frame. The user controls the color, size and icon used in the graphic
output. At the users option a site list of the database output is generated
and placed in the current mapset/location.
The user has the option of either specifying an SQL file to use for the
query, or specifying the query parameters via command arguments. If an
SQL file is specified all other options are ignored, except plot and
map. The user has the greatest flexibility with an SQL file, being able to
specify joins and other database specific features.
COMMAND LINE OPTIONS
Parameters:
- sql=filename
- SQL statements specifying well formed selection criteria. If this argument is
specified, all other arguments except plot and map will be ignored.
The SQL must return data of either two or three columns, where the first is the easting,
the second is the northing, and the optional third is a category value.
- table=name
- Name of the table containing X, Y coordinate values. If this option is selected
instead of sql, then you must specify the X and Y column names (if they aren't
"X" and "Y").
- coordx=X-coord
- Column containing the "x" (easting) coordinate value.
- coordy=Y-coord
- Column containing the "y" (northing) coordinate value.
- where=SQLwhereclause
- SQL "where" clause which specifies the query criteria to be used in
subsetting the database. The information 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.
For example, if you want to select only those records from the table
well where the value for depth is either 58 or 75 the following could be entered:
- well.depth = 58 or well.depth = 75
To select all wells in an area where the value for well is between 50 and 120:
- well.depth > 50 and well.depth < 120
To select all wells of depth greater than 75 where the value for owner is not equal to SMITH:
- well.depth > 75 and well.owner != 'SMITH'
If the database column used as the selection criteria is a character
field then the associated value must be placed in single quotes.
To determine the data types associated with columns in the currently
selected database use the g.column.pg command with the -v flag.
In addition to the operators presented in the examples above a range
of relational operators including and, or, etc. are supported. There may
be some differences in the relational operators which are supported with
different database drivers.
The examples presented above were created using the command line parser.
If d.site.pg is being called from a shell script
remember to escape quoted strings. The foll0wing example presents a
component of a shell script where the database column label
has a value of "O'Reilly".
- d.site.pg tab=well coords=utme,utmy
- where="label = O''Reilly" map=$1 plot=green,plus,2
- map=list
- Name of sites list to output
- plot=color,icon,size
- Colors: red, orange, yellow, green, blue, indigo, violet, magenta, brown, gray, white, black
- Icon: diamond, box, plus, x
- Size: 1-9
- Default: gray, x, 3
BUGS
None known.
NOTE
This program requires the PostgreSQL database software.
SEE ALSO
g.column.pg,
g.select.pg,
g.stats.pg,
g.table.pg,
d.rast.pg,
d.vect.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), Eric G. Miller
Last changed: $Date$