d.site.pg(1)		      Grass User's Manual		  d.site.pg(1)



NNAAMMEE
       _d_._s_i_t_e_._p_g  -  Display  select sites from a database query. (GRASS-RDBMS
       Interface Display Program)

SSYYNNOOPPSSIISS
       dd..ssiittee..ppgg

       dd..ssiittee..ppgg hheellpp

       dd..ssiittee..ppgg  [ssqqll=file]  ttaabb=name	ccoooorrddxx=name  ccoooorrddyy=name   [ccaattss=name]
       [wwhheerree=name] [mmaapp=name] [pplloott=color,icon,size]



AALLTTEERRNNAATTEE
       dd..vveecctt..ppgg --ss hheellpp

       dd..vveecctt..ppgg --ss ssqqll_=filename [mmaapp_=name] [pplloott==color,icon,size]

DDEESSCCRRIIPPTTIIOONN
       Query sites in a PostgreSQL database using an SQL file or by specifying
       conditions directly.  Optionally, plot display  or  send  output  to  a
       sites_list "map".

       _d_._s_i_t_e_._p_g  displays  select  point location information 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. As option, a site list of the
       database output is generated and placed in the current mapset/location.

CCOOMMMMAANNDD LLIINNEE OOPPTTIIOONNSS
   PPaarraammeetteerrss::
       ttaabb==ddaattaabbaasseettaabblleennaammee
	   Table containing X, Y coordinate values.

       ccoooorrddxx==ddaattaabbaassee__xx__ccoolluummnnnnaammee
	   Column containing x coordinate values.

       ccoooorrddyy==ddaattaabbaassee__yy__ccoolluummnnnnaammee
	   Column containing y coordinate values.

       wwhheerree==SSQQLLwwhheerreeccllaauussee
	   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: _w_e_l_l_._d_e_p_t_h _= _5_8 _o_r _w_e_l_l_._d_e_p_t_h _= _7_5





       To select all wells in an area where the value for well is  between  50
       and 120: _w_e_l_l_._d_e_p_t_h _> _5_0 _a_n_d _w_e_l_l_._d_e_p_t_h _< _1_2_0





       To  select all wells of depth greater than 75 where the value for owner
       is not equal to SMITH: _w_e_l_l_._d_e_p_t_h _> _7_5 _a_n_d _w_e_l_l_._o_w_n_e_r _!_= _'_S_M_I_T_H_'


       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  data-
       base use the _g_._c_o_l_u_m_n_._p_g 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.

       Queries more complex are best implemented using a prepared SQL file.

       mmaapp==lliisstt
	   Name of sites list to output



       ccaattss==nnaammee Name of the category field to be assigned  in	the  new  site
       list

       pplloott==ccoolloorr,,iiccoonn,,ssiizzee
	   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


       ssqqll==ffiilleennaammee
	   SQL statements specifying well formed selection criteria



AALLTTEERRNNAATTEE CCOOMMMMAANNDD LLIINNEE UUSSAAGGEE
       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.

   FFllaagg::
       --ss  SQL select statements are input from a prepared file

   PPaarraammeetteerrss::
       mmaapp==lliisstt
	   Name of sites list to output

       pplloott==ccoolloorr,,iiccoonn,,ssiizzee
	   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



       ssqqll==ffiilleennaammee
	   SQL statements specifying well formed selection criteria




	   EEXXAAMMPPLLEE::

       1. _d_._s_i_t_e_._p_g _t_a_b_=_i_z_b _c_o_o_r_d_x_=_x_c_o_o_r _c_o_o_r_d_y_=_y_c_o_o_r  _w_h_e_r_e_=_"_h_o_w___b_i_g_~_'_s_m_a_l_l_'_"
       _p_l_o_t_=_w_h_i_t_e_,_d_i_a_m_o_n_d_,_9

       RReessuulltt:: displays only 'small' huts in white color diamonds size 9

       2. _d_._s_i_t_e_._p_g _-_s _s_q_l_=_i_z_b_3_._s_q_l _m_a_p_=_h_u_t_s___g_o_o_d

       izb3.sql is:

       _s_e_l_e_c_t	_x_c_o_o_r_,_y_c_o_o_r_,_o_w_n_e_r   _f_r_o_m  _i_z_b  _w_h_e_r_e  _h_o_w___g_o_o_d	_~  _'_g_o_o_d_'  _a_n_d
       _i_z_b___i_n_f_o_._n_a_m_e_=_n_a_m_e _a_n_d _i_z_b___i_n_f_o_._r_e_c___i_d_=_n_u_m

       RReessuulltt:: displays only 'good' huts (and  only  huts  which  have	'name'
       coinciding  with  that  taken  from a table _i_z_b___i_n_f_o, linked on the hut
       number) and creates site map called _h_u_t_s___g_o_o_d with categories


BBUUGGSS
       None known.

NNOOTTEE
       This program requires the Postgres database software.

SSEEEE AALLSSOO
       _g_._s_e_l_e_c_t_._p_g_, _g_._s_t_a_t_s_._p_g_, _g_._t_a_b_l_e_._p_g_, _d_._r_a_s_t_._p_g_, _d_._v_e_c_t_._p_g_, _d_._w_h_a_t_._r_._p_g_,
       _d_._w_h_a_t_._s_._p_g_, _d_._w_h_a_t_._v_._p_g_, _r_._r_e_c_l_a_s_s_._p_g_, _r_._r_e_s_c_a_l_e_._p_g_, _v_._r_e_c_l_a_s_s_._p_g

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



GRASS 5.0							  d.site.pg(1)
