v.colors.html 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <H2>DESCRIPTION</H2>
  2. <EM>v.colors</EM> is much like <em>r.colors</em>, but may be used for vector maps.
  3. You give it a vector map and numeric data column, together with color rules
  4. like you would do for a raster. It creates a new column in the database with
  5. R:G:B values suitable for use with '<tt>d.vect -a</tt>'.
  6. <P>
  7. How it works: it creates a dummy raster map with the same data range as
  8. the vector's column then runs <em>r.colors</em> for that temporary map.
  9. It then uses <em>r.what.colors</em> for each value found by <em>v.db.select</em>
  10. and uploads it a new column in the vector map's attribute database.
  11. <P>
  12. It is planned that this script will be replaced with a C display module which
  13. renders thematic vector maps directly instead requiring the overhead of
  14. saving the colors into the DB.
  15. <P>
  16. If the target column name given by the <b>rgb_column</b> option does
  17. not exist, it will be created. The default name is "<tt>GRASSRGB</tt>".
  18. <h2>EXAMPLES</h2>
  19. Create a random sample point map, query raster map values for those points,
  20. and colorize output.
  21. <div class="code"><pre>
  22. # Spearfish dataset
  23. g.region -d
  24. v.random out=rand5k_elev n=5000
  25. v.db.addtable map=rand5k_elev column='elevation double precision'
  26. v.what.rast vector=rand5k_elev raster=elevation.10m column=elevation
  27. v.colors map=rand5k_elev column=elevation color=bcyr
  28. # display colorized points map
  29. d.mon x0
  30. d.vect -a rand5k_elev
  31. </pre></div>
  32. <p>
  33. Colorizing the roads map in Spearfish:
  34. <div class="code"><pre>
  35. g.copy vect=roads,myroads
  36. echo "1 red
  37. 2 yellow
  38. 3 orange
  39. 4 black
  40. 5 grey" &gt; colors.txt
  41. v.colors myroads column=cat rules=colors.txt
  42. # display colorized roads map
  43. d.mon x0
  44. d.vect -a myroads
  45. </pre></div>
  46. <P>
  47. Colorizing a TIN (polygons) generated by <em>v.delaunay</em>:
  48. <div class="code"><pre>
  49. # new columns for x,y,z of centroids
  50. v.db.addtable map=tin \
  51. columns="east double precision, north double precision, height double precision, GRASSRGB varchar(11)"
  52. # transfer geometry for colorizing (we need the centroid height)
  53. v.to.db tin option=coor columns="east,north,height"
  54. v.db.select tin
  55. v.colors tin column=height rgb_column=GRASSRGB color=rainbow
  56. # display colorized triangles
  57. d.mon x0
  58. d.vect -a tin
  59. </pre></div>
  60. <H2>SEE ALSO</H2>
  61. <EM>
  62. <A HREF="d.vect.html">d.vect</a> -z<br>
  63. <A HREF="r.colors.html">r.colors</A><BR>
  64. <A HREF="r.colors.stddev.html">r.colors.stddev</A><BR>
  65. <A HREF="r.what.color.html">r.what.color</A><BR>
  66. <A HREF="v.db.addcolumn">v.db.addcolumn</A><BR>
  67. <A HREF="v.db.select.html">v.db.select</A><BR>
  68. <A HREF="db.execute.html">db.execute</A>
  69. </EM>
  70. <H2>AUTHOR</H2>
  71. Hamish Bowman<BR>
  72. <i>Dunedin, New Zealand</i>
  73. <p>
  74. <i>Last changed: $Date$</i>