v.db.addtable.html 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <h2>DESCRIPTION</h2>
  2. <em>v.db.addtable</em> creates and adds a new attribute table to a given vector
  3. map. It links the table to the specified layer of the vector map. If the vector
  4. map is not yet linked to any table, new a database link is established based on
  5. the MAPSET database settings (see <em>db.connect</em>).
  6. <h2>NOTES</h2>
  7. <em>v.db.addtable</em> is a front-end to <em>db.execute</em> to allow easier
  8. usage.
  9. <p>
  10. <em>v.db.addtable</em> will only insert category values into the table for those features
  11. which actually have a category value in the relevant layer. The user can add
  12. category values automatically by using <em>v.category</em> or manually with
  13. <em><a href="wxGUI.vdigit.html">wxGUI vector digitizer</a></em>
  14. before running v.db.addtable. Or one can run v.db.addtable first
  15. and then use either a combinatino of <em>v.category</em> + <em>v.to.db</em> or
  16. <em><a href="wxGUI.vdigit.html">wxGUI vector digitizer</a></em>
  17. to add the relevant lines to the table.
  18. <p>
  19. The supported types of columns depend on the database backend. However, all
  20. backends should support VARCHAR, INT, DOUBLE PRECISION and DATE.
  21. <p>The existing database connection(s) can be verified with <em>v.db.connect</em>.
  22. <h2>EXAMPLE</h2>
  23. Adding a new attribute table with a single column to default layer 1:<br>
  24. <div class="code"><pre>
  25. g.copy vect=roadsmajor,myroads
  26. v.db.addtable myroads columns="slope double precision"
  27. v.db.connect -p myroads
  28. v.info -c myroads
  29. </pre></div>
  30. <p>Adding a new attribute table with two columns to layer 2:<br>
  31. <div class="code"><pre>
  32. g.copy vect=roadsmajor,myroads
  33. v.db.addtable myroads columns="slope double precision, roadname varchar(15)" layer=2
  34. v.db.connect -p myroads
  35. v.info -c myroads
  36. v.info -c myroads layer=2
  37. </pre></div>
  38. <h2>SEE ALSO</h2>
  39. <em>
  40. <a href="db.connect.html">db.connect</a>,
  41. <a href="db.droptable.html">db.droptable</a>,
  42. <a href="db.execute.html">db.execute</a>,
  43. <a href="v.db.addtable.html">v.db.addtable</a>,
  44. <a href="v.db.connect.html">v.db.connect</a>,
  45. <a href="v.db.dropcolumn.html">v.db.dropcolumn</a>,
  46. <a href="v.db.droptable.html">v.db.droptable</a>,
  47. <a href="v.db.select.html">v.db.select</a>,
  48. <a href="v.db.update.html">v.db.update</a><br>
  49. <a href="sql.html">GRASS SQL interface</a>
  50. </em>
  51. <h2>AUTHOR</h2>
  52. Markus Neteler
  53. <p><i>Last changed: $Date$</i>