g.gisenv.html 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <h2>DESCRIPTION</h2>
  2. When a user runs GRASS, certain variables are set specifying the GRASS
  3. data base, location, mapset, peripheral device drivers, etc., being
  4. used in the current GRASS session. These variable name settings are
  5. recognized as long as the user is running a GRASS session.
  6. <h2>OPTIONS</h2>
  7. No prompts are given to the user when running <em>g.gisenv</em>.
  8. <p>
  9. If run without arguments, <em>g.gisenv</em> lists all of the user's
  10. current GRASS variable settings. Results are sent to standard output,
  11. and may look like this:
  12. <div class="code"><pre>
  13. GISDBASE=/opt/grassdata/
  14. LOCATION_NAME=nc_spm_08_grass7
  15. MAPSET=/user1
  16. GUI=gui
  17. </pre></div>
  18. <p>If the user specifies a <b>get=</b><em>variable_name</em> on the
  19. command line
  20. <div class="code"><pre>
  21. g.gisenv MAPSET
  22. </pre></div>
  23. only the value for that particular GRASS variable is output to
  24. standard output. Possible variable names depend on the user's system,
  25. see <a href="variables.html">variables list</a> for details. Note that
  26. the variable names are case-insensitive.
  27. <p>While other variables may be associated with each GRASS session (e.g.,
  28. GRASS_GUI, GIS_LOCK, and other variables), those stated below
  29. are essential.
  30. <dl>
  31. <dt><em>GISDBASE</em>
  32. <dd>The <em>GISDBASE</em> is a directory in which all users' GRASS
  33. data are stored. Within the <em>GISDBASE</em>, data are segregated
  34. into subdirectories (called &quot;locations&quot;) based on the map
  35. coordinate system used and the geographic extent of the data. Each
  36. &quot;location&quot; directory itself contains subdirectories called
  37. &quot;mapsets&quot;; each &quot;mapset&quot; stores &quot;data base
  38. elements&quot; - the directories (e.g.,
  39. the <tt>cell</tt>, <tt>cellhd</tt>, <tt>vector</tt>, etc., directories)
  40. in which GRASS data files are actually stored.
  41. <dt><em>LOCATION_NAME</em>
  42. <dd>The user must choose to work with the data under a single GRASS
  43. location within any given GRASS session; this location is then called
  44. the <em>current GRASS location</em>, and is specified by the variable
  45. <em>LOCATION_NAME</em>. The <em>LOCATION_NAME</em> is the GRASS data
  46. base location whose data will be affected by any GRASS commands issued
  47. during the user's current GRASS session, and is a subdirectory of the
  48. current <em>GISDBASE</em>. Each &quot;location&quot; directory can
  49. contain multiple &quot;mapset&quot; directories (including the special
  50. mapset <em>PERMANENT</em>). Maps stored under the same
  51. GRASS <em>LOCATION_NAME</em> (and/or within the same <em>MAPSET</em>)
  52. must use the same coordinate system and typically fall within the
  53. boundaries of the same geographic region (aka, &quot;location&quot;).
  54. <dt><em>MAPSET</em>
  55. <dd>Each &quot;mapset&quot; contains a set of maps relevant to the
  56. <em>LOCATION_NAME</em> directory in which it appears.
  57. Each <em>LOCATION_NAME</em> can contain multiple mapsets. (Mapsets
  58. which fall under the same <em>LOCATION_NAME</em> all contain data
  59. geographically relevant to the <em>LOCATION_NAME</em>, and all store
  60. data in the same map coordinate system. Frequently, maps are placed
  61. into different mapsets to distinguish file ownership - e.g., each user
  62. might have one or more own mapset(s), storing any maps that the user has
  63. created and/or are relevant to the own work.) During each GRASS session, the
  64. user must choose one mapset to be the <em>current mapset</em>; the current
  65. mapset setting is given by <em>MAPSET</em>, and is a subdirectory
  66. of <em>LOCATION_NAME</em>. During a single GRASS session, the user
  67. can use available data in any of the mapsets stored under the
  68. current <em>LOCATION_NAME</em> directory that are in the user's
  69. mapset search path and accessible by the user. However, within a
  70. single GRASS session, the user only has <em>write</em> access to data
  71. stored under the <em>current mapset</em> (specified by the
  72. variable <em>MAPSET</em>).
  73. <p>Each &quot;mapset&quot; stores GRASS data base elements (i.e., the
  74. directories in which GRASS data files are stored). Any maps created
  75. or modified by the user in the current GRASS session will be stored
  76. here. The <em>MAPSET</em> directory <em>PERMANENT</em> is generally
  77. reserved for the set of maps that form the base set for all users
  78. working under each <em>LOCATION_NAME</em>.
  79. </dl>
  80. <p>
  81. Once within a GRASS session, GRASS users have access only to the data
  82. under a single GRASS data base directory (the <em>current GRASS data
  83. base</em>, specified by the variable <em>GISDBASE</em>), and to a
  84. single GRASS location directory (the <em>current location</em>,
  85. specified by the variable <em>LOCATION_NAME</em>). Within a single
  86. session, the user may only <em>modify</em> the data in the
  87. <em>current mapset</em> (specified by the variable
  88. <em>MAPSET</em>), but may <em>use</em> data available under other
  89. mapsets under the same <em>LOCATION_NAME</em>.
  90. <p>All of these names must be legal names on the user's current system.
  91. <!--For UNIX users, names less than 14 characters and containing no
  92. non-printing or space codes are permissible. Examples of permissible
  93. names include: <em>one</em>, <em>mymap</em>, <em>VeGe_map</em>, and
  94. <em>1_for_me</em>. The underscore character can safely be
  95. used in place of a blank for multiple-word names.
  96. -->
  97. <p>
  98. The full path to the current mapset is determined
  99. from <em>GISDBASE</em>, <em>LOCATION_NAME</em>, <em>MAPSET</em>
  100. variables, in the example
  101. above: <tt>/opt/grassdata/spearfish/PERMANENT</tt>. The full path can
  102. be printed using <em>g.gisenv</em> by providing multiple variables:
  103. <div class="code"><pre>
  104. g.gisenv get=GISDBASE,LOCATION_NAME,MAPSET sep='/'
  105. /opt/grassdata/nc_spm_08_grass7/user1
  106. </pre></div>
  107. <h2>NOTES</h2>
  108. The output from
  109. <em>g.gisenv</em>
  110. when invoked without arguments is directly usable by Bash. The
  111. following command will cast each variable into the UNIX environment:
  112. <div class="code"><pre>
  113. eval `g.gisenv`
  114. </pre></div>
  115. This works only for <em>Bash</em>, <em>sh</em>, <em>ksh</em>, etc. The format of the output is not
  116. compatible with some other UNIX shells.
  117. <p>
  118. By default the GRASS variables are stored in <em>gisrc</em> file
  119. (defined by environmental
  120. variable <em>GISRC</em>). If <b>store=mapset</b> is given then the
  121. variables are stored in <tt>&lt;gisdbase&gt;/&lt;location&gt;/&lt;mapset&gt;/VAR</tt>
  122. after the current GRASS session is closed.
  123. <h3>GRASS Debugging</h3>
  124. To print debugging messages, the variable <em>DEBUG</em> must be set to level
  125. equal or greater than 0:
  126. <div class="code"><pre>
  127. g.gisenv set="DEBUG=3"
  128. </pre></div>
  129. Levels: (recommended levels)
  130. <ul>
  131. <li> 0 - silence
  132. <li> 1 - message is printed once or few times per module
  133. <li> 3 - each row (raster) or line (vector)
  134. <li> 5 - each cell (raster) or point (vector)
  135. </ul>
  136. To disable debugging messages:
  137. <div class="code"><pre>
  138. g.gisenv unset="DEBUG"
  139. </pre></div>
  140. The variable DEBUG controls debugging messages from GRASS libraries
  141. and modules.
  142. <p>
  143. Similarly <em>WX_DEBUG</em> controls debugging messages
  144. from <a href="wxGUI.html">wxGUI</a>.
  145. <h2>SEE ALSO</h2>
  146. <em>
  147. <a href="g.access.html">g.access</a>,
  148. <a href="g.filename.html">g.filename</a>,
  149. <a href="g.findfile.html">g.findfile</a>,
  150. <a href="g.mapsets.html">g.mapsets</a>
  151. </em>
  152. <p>
  153. See also <a href="variables.html">variables list</a>
  154. <h2>AUTHOR</h2>
  155. Michael Shapiro,
  156. U.S.Army Construction Engineering Research Laboratory