v.to.pg(1)	       Grass User's Manual	       v.to.pg(1)



NNAAMMEE
       _v_._t_o_._p_g	-  Export areas and lines from an existing vector
       map to Postgres table. (GRASS-RDBMS Interface Display Pro-
       gram)

SSYYNNOOPPSSIISS
       vv..ttoo..ppgg

       vv..ttoo..ppgg hheellpp

       vv..ttoo..ppgg	[[--ffvvtt]]	kkeeyy=_n_a_m_e  ttaabb=_n_a_m_e ttyyppee=_n_a_m_e [wwhheerree=_n_a_m_e]
       mmaapp=_n_a_m_e [ccoolloorr=_n_a_m_e]

AALLTTEERRNNAATTEE
       vv..ttoo..ppgg --ss hheellpp

       vv..ttoo..ppgg ]]--ssffvv]] ssqqll_=_f_i_l_e_n_a_m_e mmaapp_=_n_a_m_e ttyyppee=_n_a_m_e[ccoolloorr_=_n_a_m_e]

DDEESSCCRRIIPPTTIIOONN
       _v_._t_o_._p_g	exports vectors from an existing vector map based
       on the unique values in a database column  (or  optionally
       all vectors without referencing to any existing table, see
       -t option).  Each  row  returned  by  a	user  constructed
       database  query	will  be associated with a vector feature
       which may be drawn on the graphics display if X-windows is
       present. The user can control the color of the vector draw
       by specifying a color on the command line.

       As result, a new Postgres table _t_a_b_l_e___b_n_d or _t_a_b_l_e___a_r_c  is
       created holding areas as internal type "polygon" and lines
       as "open path", where _t_a_b_l_e is the ttaabb parameter.  Besides
       these  elements	in fields called _b_o_u_n_d_a_r_y or _s_e_g_m_e_n_t, the
       table would also have the category  field  (named  as  kkeeyy
       parameter),  case  number  this category occured (as field
       called 'num'), and an extra boolean field 'ex' for  'true'
       if  the	polygon  is  external and 'f' if it is a hole for
       _t_a_b_l_e___b_n_d only.

CCOOMMMMAANNDD LLIINNEE OOPPTTIIOONNSS
   FFllaagg::
       --ff  Fill polygons selected on the query criteria.

       --tt  Export all map vectors without reference  to  existing
	   table ('where' clause ignored).

       --vv  Verbose  mode with statistics on the completion of the
	   insertions.


   PPaarraammeetteerrss::
       kkeeyy==ddaattaabbaasseeccoolluummnnnnaammee
	   Column  in  table  "tab"  of  the  currently  selected
	   database containing values corresponding to the vector
	   maps category values. Table is designated on the  com-
	   mand  line by tab=tablename and vector is given on the
	   command line by map=mapname.

       ttaabb==ddaattaabbaasseettaabblleennaammee
	   Table in the currently selected database containing	a
	   column  which has values corresponding to vector cate-
	   gory values in the map designated by map=map.

       wwhheerree==SSQQLLwwhheerreeccllaauussee
	   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  col-
	   umn(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_._c_o_l_-
       _u_m_n_._p_g command with the _-_v flag.

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

       mmaapp==mmaapp
	   Name of an existing vector map  with  category  values
	   which  correspond  to  values in a specified column in
	   the currently selected database.

       ccoolloorr==nnaammee
	   Color to draw vectors in Colors: red, orange,  yellow,
	   green,  blue,  indigo,  violet,  magenta, brown, gray,
	   white, black

       ttyyppee==aarreeaa,,lliinnee
	   Type of the coverage to export.


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 com-
       mand 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

       --ff  Fill polygons selected on the query criteria

       --vv  Verbose mode with statistics on the completion of  the
	   insertions.


   PPaarraammeetteerrss::
       ssqqll==ffiilleennaammee
	   SQL statements specifying well formed selection crite-
	   ria.

       mmaapp==nnaammee
	   Name of an existing vector map

       ccoolloorr==nnaammee
	   Color to draw vectors in Colors: red, orange,  yellow,
	   green,  blue,  indigo,  violet,  magenta, brown, gray,
	   white, black

       ttyyppee==aarreeaa,,lliinnee
	   Type of the coverage to export.



       EEXXAAMMPPLLEE::

       11.. _v_._t_o_._p_g  _-_f  _k_e_y_=_r_e_c___i_d  _m_a_p_=_k_u_r_u_m_a___i_d  _t_a_b_=_i_n_f_o___k_u_r_u_m_a
       _t_y_p_e_=_a_r_e_a _w_h_e_r_e_=_'_t_y_p_e___i_d _>_3_2 _a_n_d _t_y_p_e___i_d _< _3_8_'  _c_o_l_o_r_=_r_e_d



       RReessuulltt::	only  polygons	with type in 33-37 range would be
       inserted in table _i_n_f_o___k_u_r_u_m_a___b_n_d  and  displayed  in  red
       color.

       22.. _v_._t_o_._p_g _-_v _-_s _-_f _s_q_l_=_o_a_k_._s_q_l _m_a_p_=_k_u_r_u_m_a___i_d _t_y_p_e_=_a_r_e_a

       oak.sql is:

       _s_e_l_e_c_t  _r_e_c___i_d  _f_r_o_m  _i_n_f_o___k_u_r_u_m_a  _w_h_e_r_e  _t_y_p_e___i_d _> _3_2 _a_n_d
       _t_y_p_e___i_d _<_3_8_;

       RReessuulltt:: this would be the same as in  the  first  example,
       with some information printed on screen.

BBUUGGSS
       none

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_._s_i_t_e_._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
       Alex Shevlakov (sixote@yahoo.com)



GRASS 5.0					       v.to.pg(1)
