d.legend.vect.html 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <h2>DESCRIPTION</h2>
  2. Module <em>d.legend.vect</em> draws vector legend of currently displayed vector maps.
  3. <p>
  4. Parameter <b>at</b> defines the screen position of upper-left legend corner.
  5. Parameter <b>columns</b> defines the number of legend columns.
  6. User can specify a title of the legend using parameter <b>title</b>.
  7. The font of the title can be changed with <b>title_font</b>, <b>title_fontsize</b>.
  8. Flag <b>-b</b> is used to draw background of specified color (<b>bgcolor</b>),
  9. border color and border width (<b>border_color</b> and <b>border_width</b>).
  10. Parameter <b>symbol_size</b> defines the size of line and area symbols.
  11. The size of point symbols is based on currently set symbology of vector maps using
  12. <em><a href="d.vect.html">d.vect</a></em> or
  13. <em><a href="d.vect.thematic.html">d.vect.thematic</a></em>.
  14. <p>Module <em>d.vect.legend</em> supports subtitles (see section Notes).
  15. Their font and font size can be set using parameters <b>sub_font</b>
  16. and <b>sub_fontsize</b>.
  17. <h3>Changing legend symbols and labels</h3>
  18. Symbols for vector areas and lines, and labels for individual vector labels
  19. can be changed in the symbology setting of each vector map in
  20. <em><a href="d.vect.html">d.vect</a></em> or
  21. <em><a href="d.vect.thematic.html">d.vect.thematic</a></em>
  22. module (in Legend tab). Use its parameters
  23. <b>icon_area</b> and <b>icon_line</b> to pick from available symbols.
  24. By using parameter <b>legend_label</b> of <em>d.vect</em> module, users can change
  25. the default label, which is the map name.
  26. <h3>Modifying the order of legend entries and omitting certain vector maps
  27. from legend</h3>
  28. Modules <em><a href="d.vect.html">d.vect</a></em> and
  29. <em><a href="d.vect.thematic.html">d.vect.thematic</a></em>
  30. have a flag <b>-s</b>
  31. which removes the particular vector or thematic vector from vector legend.
  32. <p>The order of entries is defined by the order in Layer Manager (if used
  33. in GRASS GIS GUI). If that's not desired, one can export the legend file
  34. into a text file using parameter <b>output</b>, change the order of entries
  35. (see section Notes for format description) and then upload the modified file
  36. with parameter <b>input</b>.
  37. Parameter <b>output</b> defines path to the file where the internal legend
  38. file will be saved to, <b>input</b> defines the input file which
  39. the vector legend will be based on (input file must have correct format).
  40. <h2>NOTES</h2>
  41. Module <em>d.legend.vect</em> draws vector legend based on legend file defined
  42. in shell environment variable GRASS_LEGEND_FILE.
  43. This file is automatically created and updated whenever
  44. <em><a href="d.vect.html">d.vect</a></em> command is used.
  45. User can create custom legend file and then use
  46. <em>export GRASS_LEGEND_FILE=path/to/file</em> in shell.
  47. GRASS GUI and MONITORS create the legend file automatically.
  48. By default the legend file is stored in grassdata/location/mapset/.tmp/user
  49. directory (in case of d.mon deeper in /monitor_name directory).<br>
  50. <p>
  51. Legend file has this format:
  52. <pre>
  53. label|symbol_name|size|color_type|feature_color|fill_color|line_width|geometry_type|feature_count
  54. </pre>
  55. Color type can be 'lf' or 'ps'. Based on color type color columns are interpreted
  56. as line color and fill colors (lf), or primary and secondary colors (ps).
  57. Module d.vect always uses 'lf' and d.vect.thematic 'ps'.
  58. Here is an example of legend file with subtitles:
  59. <pre>
  60. Infrastructure||||||||
  61. major roads|legend/line|5|lf|black|200:200:200|2|line|355
  62. bridges|extra/bridge|15|lf|black|black|1|point|10938
  63. Hydrology||||||||
  64. streams|legend/line_crooked|5|lf|30:144:255|200:200:200|3|line|8554
  65. water bodies|legend/area_curved|5|lf|none|30:144:255|1|area|27764
  66. </pre>
  67. <img alt="Example of subheadings used in vector legend"
  68. src="d_legend_vect_subheadings.png">
  69. <h2>EXAMPLES</h2>
  70. Open cairo monitor to render to file:
  71. <div class="code"><pre>
  72. g.region vector=nc_state
  73. d.mon cairo
  74. d.vect map=nc_state color=26:26:26 fill_color=229:229:229 width=2 legend_label="state boundaries"
  75. d.vect map=urbanarea color=none fill_color=127:127:127 width=1 legend_label="urban areas"
  76. d.vect map=railroads color=red width=1
  77. d.vect map=hospitals color=77:77:77 fill_color=0:187:0 width=1 icon=basic/cross3 size=10
  78. d.legend.vect -b at=2,40 title="Hospitals in North Carolina" symbol_size=26 fontsize=16 title_fontsize=20
  79. </pre></div>
  80. <center>
  81. <img src="d_legend_vect.png" alt="d.legend.vect example"><br>
  82. </center>
  83. <h2>SEE ALSO</h2>
  84. <em>
  85. <a href="d.vect.html">d.vect</a>,
  86. <a href="d.vect.thematic.html">d.vect.thematic</a>,
  87. <a href="d.legend.html">d.legend</a>
  88. </em>
  89. <p>
  90. Check also Python module from
  91. AddOns: <em><a href="https://grass.osgeo.org/grass7/manuals/addons/d.vect.thematic2.html">d.vect.thematic2</a></em>
  92. <h2>AUTHOR</h2>
  93. Adam Laza, during GSoC 2016
  94. Mentors: Anna Petrasova, Vaclav Petras, Martin Landa
  95. <p>
  96. <i>Last changed: $Date$</i>