variables.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html>
  3. <head>
  4. <title>GRASS variables and environment variables</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  6. <link rel="stylesheet" href="grassdocs.css" type="text/css">
  7. </head>
  8. <body bgcolor="white">
  9. <img src="grass_logo.png" alt="_\|/_ GRASS logo"><hr align=center size=6 noshade>
  10. <h2>GRASS variables and environment variables</h2>
  11. <!-- file source:
  12. ./lib/init/variables.html
  13. -->
  14. There are two types of variables:
  15. <ul>
  16. <li><a href="#enviro">shell environment</a> variables,</li>
  17. <li><a href="#gisenv">GRASS gisenv</a> variables.</li>
  18. </ul>
  19. There are a number of <i>shell</i> environment variable groups:
  20. <ul>
  21. <li><a href="#png">PNG driver</a></li>
  22. <li><a href="#ps">PS driver (PostScript)</a></li>
  23. <li><a href="#html">HTMLMAP driver</a></li>
  24. <!--<li><a href="#cairo">Cairo driver</a></li>-->
  25. <li><a href="#dirrend">variables for direct rendering</a></li>
  26. <li><a href="#internal">variables for internal use</a></li>
  27. </ul>
  28. Any setting which needs to be modifiable by a GRASS program (e.g. MONITOR)
  29. has to be a GRASS <i>gisenv</i> variable.
  30. <h2>GRASS-related Files</h2>
  31. GRASS maintains some settings in a number of files on the system. They are
  32. detailed <a href="#files">below</a>.
  33. <h2>Setting environment variables</h2>
  34. Setting environment variables depends on the shell being used:
  35. <br><br>
  36. Bash:
  37. <div class="code"><pre>
  38. export VARIABLE=value
  39. </pre></div>
  40. Csh:
  41. <div class="code"><pre>
  42. setenv VARIABLE value
  43. </pre></div>
  44. Cmd.exe (Windows):
  45. <div class="code"><pre>
  46. set VARIABLE=value
  47. </pre></div>
  48. <h2>Setting environment variables permanently</h2>
  49. <ul>
  50. <li>
  51. To get personal BASH shell definitions (aliases, color listing option, ...)
  52. into GRASS, store them in:<br>
  53. <tt>$HOME/.grass.bashrc</tt></li>
  54. <li>
  55. To get personal CSH shell definitions (aliases, color listing option, ...)
  56. into GRASS, store them in:<br>
  57. <tt>$HOME/.grass.cshrc</tt></li>
  58. </ul>
  59. <h2>Setting GRASS variables</h2>
  60. Use <em><a href="g.gisenv.html">g.gisenv</a></em> within GRASS. This permanently
  61. predefines GRASS variables in the <tt>.grassrc7</tt> file.
  62. <br><br>
  63. Usage:
  64. <div class="code"><pre>
  65. g.gisenv set="VARIABLE=VALUE"
  66. </pre></div>
  67. It looks unusual with two equals signs, but <em>g.gisenv</em> serves dual duty for
  68. getting and setting GRASS variables.
  69. <p>
  70. If the user just specifies a variable name, it defaults to <b>get</b> mode.
  71. For example:
  72. <div class="code"><pre>
  73. g.gisenv GRASS_GUI
  74. text
  75. </pre></div>
  76. <a name="enviro"></a>
  77. <h2>List of selected (GRASS related) environment variables</h2>
  78. <blockquote>
  79. [ To be set from the terminal shell or startup scripts ]
  80. </blockquote>
  81. <dl>
  82. <dt>GISBASE</dt>
  83. <dd>directory where GRASS lives. This is set automatically by the
  84. startup script.</dd>
  85. <dt>GISRC</dt>
  86. <dd>name of <tt>.grassrc7</tt> file. Defines the system wide value
  87. while in a GRASS session.</dd>
  88. <dt>GRASS_ADDON_PATH</dt>
  89. <dd>[grass startup script]<br>
  90. allows to specify additional paths to local GRASS modules extra
  91. to standard distribution.</dd>
  92. <dt>GRASS_ADDON_ETC</dt>
  93. <dd>[libgis, g.findetc]<br>
  94. specify paths where support files (etc/) may be found external to
  95. standard distribution.</dd>
  96. <dt>GRASS_BATCH_JOB</dt>
  97. <dd>defines the name (path) of a shell script to be processed as batch job.</dd>
  98. <dt>GIS_ERROR_LOG</dt>
  99. <dd>If set, $GIS_ERROR_LOG should be the absolute path to the log file (a
  100. relative path will be interpreted relative to the process' cwd, not
  101. the cwd at the point the user set the variable). If not set,
  102. $HOME/GIS_ERROR_LOG is used instead. The file will only be used if
  103. it already exists.</dd>
  104. <dt>GRASS_ERROR_MAIL</dt>
  105. <dd>set to any value to send user mail on an error or warning that
  106. happens while stderr is being redirected.</dd>
  107. <dt>GRASS_GNUPLOT</dt>
  108. <dd>[<!-- m.svfit, s.probplt, s.sv -->i.spectral]<br>
  109. program to use for plotting <em>gnuplot</em> data.</dd>
  110. <dt>GRASS_GUI</dt>
  111. <dd>either <tt>text</tt> or <tt>gui</tt> to define non-/graphical startup.
  112. <br><br>
  113. Can also specify the name of the GUI to use, e.g. <tt>tcltk</tt>
  114. (<em><a href="gis.m.html">gis.m</a></em>), <tt>oldtcltk</tt>
  115. (<em><a href="d.m.html">d.m</a></em>) or <tt>wxpython</tt>
  116. (<em><a href="wxGUI.html">wxGUI</a></em>). Also exists as a GRASS
  117. gisenv variable (see below). If this shell variable exists at GRASS
  118. startup, it will determine the GUI used. If it is not defined startup
  119. will default to the last GUI used.</dd>
  120. <dt>GRASS_FONT_CAP</dt>
  121. <dd>[g.mkfontcap, d.font, display drivers]<br>
  122. specifies an alternative location (to $GISBASE/etc/fontcap) for
  123. the font configuration file.</dd>
  124. <dt>GRASS_HEIGHT</dt>
  125. <dd>[d.mon]<br>
  126. defines the height of GRASS monitor, see also GRASS_WIDTH.</dd>
  127. <dt>GRASS_HTML_BROWSER</dt>
  128. <dd>[init.sh, d.m, gis.m]<br>
  129. defines name of HTML browser. For most platforms this should be
  130. an executable in your PATH, or the full path to an executable.<br><br>
  131. Mac OS X runs applications differently from the CLI.
  132. Therefore, GRASS_HTML_BROWSER should be the application's signature,
  133. which is a domain-like name, just reversed, i.e. com.apple.Safari. To
  134. find an application's signature, type the following in a Terminal
  135. (fill in the path to the application you are interested in, for
  136. example: /Applications/Safari.app):<br> &nbsp; &nbsp; <code>grep -A 1
  137. &quot;CFBundleIdentifier&quot;</code> <i>/path/to/application.app</i><code>/Contents/Info.plist</code><br>
  138. &nbsp; The signature is the &lt;string&gt; following the &lt;key&gt;,
  139. without the bracketing &lt;string&gt; tags.</dd>
  140. <dt>GRASS_INT_ZLIB</dt>
  141. <dd>[libgis]<br>
  142. if the environment variable GRASS_INT_ZLIB exists, new compressed
  143. rasters will be compressed using zlib instead of RLE
  144. compression. Such rasters will have a <tt>compressed</tt> value of 2 in the
  145. cellhd file.
  146. <br><br>
  147. Obviously, decompression is controlled by the
  148. raster's <tt>compressed</tt> value, not the environment variable.
  149. </dd>
  150. <dt>GRASS_MESSAGE_FORMAT</dt>
  151. <dd>[various modules]<br>
  152. maybe set to either <tt>standard</tt> or <tt>gui</tt> (normally
  153. GRASS takes care).</dd>
  154. <dt>GRASS_MOUSE_BUTTON</dt>
  155. <dd>[various modules]<br>
  156. swaps mouse buttons for two-button or left-handed mice. Its value
  157. has three digits 1, 2, and 3, which represent default left, middle, and right
  158. buttons respectively. Setting to <tt>132</tt> will swap middle and right buttons. Note
  159. that this variable should be set before a display driver is initialized (e.g.,
  160. <tt>d.mon x0</tt>).</dd>
  161. <dt>GRASS_PAGER</dt>
  162. <dd>[various modules]<br>
  163. maybe set to either <tt>less</tt> or <tt>more</tt>.</dd>
  164. <dt>GRASS_PERL</dt>
  165. <dd>[used during install process for generating man pages]<br>
  166. set Perl with path.</dd>
  167. <dt>GRASS_RND_SEED</dt>
  168. <dd>set random seed
  169. for <em><a href="r.mapcalc.html">r.mapcalc</a></em> rand()
  170. function.</dd>
  171. <!-- HB Sept 2005: I don't think this exists anymore:
  172. <p>GRASS_STDERR
  173. <br>&nbsp; set to any value to prevent user mail on error
  174. -->
  175. <dt>GRASS_SH</dt>
  176. <dd>[shell scripts on Windows]<br>
  177. path to bourne shell interpreter used to run shell scripts.</dd>
  178. <dt>GRASS_PYTHON</dt>
  179. <dd>[wxGUI, Python SWIG]<br>
  180. set to override Python executable.</dd>
  181. <dt>GRASS_TCLSH</dt>
  182. <dd>[nviz]<br>
  183. set tclsh shell name to override 'tclsh'.</dd>
  184. <dt>GRASS_XTERM</dt>
  185. <dd>lib/init/grass-xterm-wrapper<br>
  186. lib/init/grass-xterm-mac<br>
  187. set to any value (e.g. rxvt, aterm, gnome-terminal, konsole) to
  188. substitute 'x-terminal-emulator' or 'xterm'. The Mac OS X app
  189. startup defaults to an internal '$GISBASE/etc/grass-xterm-mac',
  190. which emulates the necessary xterm functionality in
  191. Terminal.app.</dd>
  192. <dt>GRASS_UI_TERM</dt>
  193. <dd>set to any value to use the terminal based parser.</dd>
  194. <dt>GRASS_VERSION</dt>
  195. <dd>reports the current version number (used by R-stats interface etc);
  196. should not be changed by user.</dd>
  197. <dt>GRASS_WIDTH</dt>
  198. <dd>[d.mon]<br>
  199. defines the width of GRASS monitor, see also GRASS_HEIGHT.</dd>
  200. <dt>GRASS_WISH</dt>
  201. <dd>[d.m, nviz]<br>
  202. set wish shell name to override 'wish'.</dd>
  203. <dt>GRASS_NO_GLX_PBUFFERS</dt>
  204. <dd>[nviz]<br>
  205. set to any value to disable the use of GLX Pbuffers.</dd>
  206. <dt>GRASS_NO_GLX_PIXMAPS</dt>
  207. <dd>[nviz]<br>
  208. Set to any value to disable the use of GLX Pixmaps.</dd>
  209. </dl>
  210. <a name="png"></a>
  211. <h3>List of selected GRASS PNG driver environment variables</h3>
  212. <blockquote>
  213. [ These variables control the function of the PNG driver ]
  214. </blockquote>
  215. See <a href="pngdriver.html">PNG driver</a> manual page for detailed
  216. list of the variables.
  217. <!--
  218. 2008/03 -- -- variables are described in PNG driver manual
  219. page. The link should be enough here.
  220. <P></P>
  221. <p>GRASS_PNGFILE
  222. <br>&nbsp; name of PNG output file. If it ends with ".ppm" a PPM file will be created.
  223. <p>GRASS_WIDTH
  224. <br>&nbsp; defines the width of GRASS monitor, see also GRASS_HEIGHT
  225. <p>GRASS_HEIGHT
  226. <br>&nbsp; defines the height of GRASS monitor, see also GRASS_WIDTH
  227. <p>GRASS_BACKGROUNDCOLOR
  228. <br>&nbsp; defines the background color of the image created by the PNG driver
  229. <p>GRASS_TRANSPARENT
  230. <br>&nbsp; if "TRUE", the image created by the PNG driver will have a
  231. transparent background
  232. <p>GRASS_PNG_COMPRESSION
  233. <br>&nbsp; compression level of PNG files (0 = none, 1 = fastest, 9 = best)
  234. <p>GRASS_TRUECOLOR
  235. <br>&nbsp; if "TRUE", the PNG driver generates a true-color image
  236. <p>GRASS_PNG_AUTO_WRITE
  237. <br>&nbsp; tells the PNG driver to write the image to a file whenever a
  238. client disconnects, rather than waiting until you stop the monitor
  239. <p>GRASS_PNG_READ
  240. <br>&nbsp; if "TRUE", the PNG driver will initialize the image from
  241. the contents of $GRASS_PNGFILE
  242. <p>GRASS_PNG_MAPPED
  243. <br>&nbsp; if "TRUE", the PNG driver will map $GRASS_PNGFILE as its framebuffer,
  244. rather than using memory; this only works with BMP files
  245. -->
  246. <a name="ps"></a>
  247. <h3>List of selected GRASS PS driver environment variables</h3>
  248. <blockquote>
  249. [ These variables control the function of the PS driver ]
  250. </blockquote>
  251. See <a href="psdriver.html">PS driver</a> manual page for detailed
  252. list of the variables.
  253. <!--
  254. 2008/03 -- -- variables are described in PS driver manual
  255. page. The link should be enough here.
  256. <P></P>
  257. <p>GRASS_PSFILE
  258. <br>&nbsp; name of output file. If it ends with ".eps" an EPS file
  259. will be created.
  260. <p>GRASS_PAPER <br>&nbsp; sets the screen dimensions and margins to
  261. fit a standard paper size, see also GRASS_WIDTH, GRASS_HEIGHT.
  262. <p>GRASS_WIDTH
  263. <br>&nbsp; defines the width of the screen, see also GRASS_HEIGHT
  264. <p>GRASS_HEIGHT
  265. <br>&nbsp; defines the height of the screen, see also GRASS_WIDTH
  266. <p>GRASS_TRUECOLOR
  267. <br>&nbsp; if "TRUE", the PS driver generates color output, otherwise
  268. monochrome.
  269. <p>GRASS_LANDSCAPE
  270. <br>&nbsp; if "TRUE", the screen is rotated 90 degrees
  271. counter-clockwise so that a "landscape" screen fits better on
  272. "portrait" paper.
  273. <p>GRASS_PS_HEADER
  274. <br>&nbsp; if "FALSE", the output is appended to any existing file,
  275. and no prolog or setup sections are generated.
  276. <p>GRASS_PS_TRAILER
  277. <br>&nbsp; if "FALSE", no trailer section is generated.
  278. -->
  279. <a name="html"></a>
  280. <h3>List of selected HTMLMAP driver environment variables</h3>
  281. <blockquote>
  282. [ These variables control the function of the HTMLMAP driver ]
  283. </blockquote>
  284. See <a href="htmlmapdriver.html">HTMLMAP driver</a> manual page for
  285. detailed list of the variables.
  286. <!--
  287. <a name="cairo"></a>
  288. <h3>List of selected Cairo driver environment variables</h3>
  289. <blockquote>
  290. [ These variables control the function of the Cairo driver ]
  291. </blockquote>
  292. See <a href="cairodriver.html">Cairo driver</a> manual page for
  293. detailed list of the variables.
  294. -->
  295. <a name="dirrend"></a>
  296. <h3>List of selected GRASS environment variables for direct rendering</h3>
  297. <blockquote>
  298. [ In addition to those which are understood by the
  299. <a href="pngdriver.html">PNG driver</a>, the following variables
  300. affect direct rendering. ]
  301. </blockquote>
  302. <dl>
  303. <dt>GRASS_RENDER_IMMEDIATE</dt>
  304. <dd>tells the raster library to use its built-in PNG/PS driver rather
  305. than connecting to an external monitor process using sockets. If
  306. GRASS_RENDER_IMMEDIATE=TRUE is set, there is no need to run
  307. <tt>d.mon&nbsp;start=PNG</tt>.</dd>
  308. <dt>GRASS_FONT</dt>
  309. <dd>specifies the font as either the name of a font from
  310. $GISBASE/etc/fontcap (or alternative fontcap file specified by GRASS_FONT_CAP),
  311. or alternatively the full path to a FreeType font file.</dd>
  312. <dt>GRASS_ENCODING</dt>
  313. <dd>the encoding to be assumed for text which is drawn using a
  314. freetype font; may be any encoding know to <em>iconv</em>.</dd>
  315. </dl>
  316. <a name="internal"></a>
  317. <h3>List of selected internal GRASS environment variables</h3>
  318. <blockquote>
  319. [ These variables are intended <b>for internal use only</b> by the GRASS
  320. software to facilitate communication between the GIS engine, GRASS scripts,
  321. and the GUI.
  322. The user should not set these in a GRASS session. They are meant to be set
  323. locally for specific commands. ]
  324. </blockquote>
  325. <dl>
  326. <dt>GRASS_OVERWRITE</dt>
  327. <dd>[all modules]<br>
  328. toggles map overwrite.
  329. <ul>
  330. <li>0 - maps are protected (default),</li>
  331. <li>1 - maps with identical names will be overwritten.</li>
  332. </ul>
  333. This variable is automatically created
  334. by <em><a href="g.parser.html">g.parser</a></em> so that the
  335. <tt>--overwrite</tt> option will
  336. be inherited by dependant modules as the script runs. Setting either the
  337. GRASS_OVERWRITE environment variable or the OVERWRITE gisenv variable detailed
  338. below will cause maps with identical names to be overwritten.</dd>
  339. <dt>GRASS_VERBOSE</dt>
  340. <dd>[all modules]<br>
  341. toggles verbosity level
  342. <ul>
  343. <li>0 - only errors and warnings are printed</li>
  344. <li>1 - progress messages are printed (percent complete)</li>
  345. <li>2 - all module messages are printed</li>
  346. <li>3 - additional verbose messages are printed</li>
  347. </ul>
  348. This variable is automatically created by <em><a href="g.parser.html">g.parser</a></em>
  349. so that the <tt>--verbose</tt> or <tt>--quiet</tt> flags will be inherited
  350. by dependant modules as the script runs.</dd>
  351. <dt>GRASS_REGION</dt>
  352. <dd>[libgis]<br>
  353. override region settings, separate parameters with a ";". Format
  354. is the same as in the WIND region settings file. Otherwise use is the same as
  355. WIND_OVERRIDE.</dd>
  356. <dt>WIND_OVERRIDE</dt>
  357. <dd>[libgis]<br>
  358. it causes programs to use the specified named region (created with
  359. e.g. <tt>g.region save=...</tt>) to be used as the current region, instead of
  360. the region from the WIND file.<br><br>
  361. This allows programs such as gis.m to run external commands on an
  362. alternate region without having to modify the WIND file then change it
  363. back afterwards.</dd>
  364. </dl>
  365. <a name="gisenv"></a>
  366. <h2>List of selected GRASS gisenv variables</h2>
  367. <blockquote>
  368. [ Use <em>g.gisenv</em> to get/set/unset/change them ]
  369. </blockquote>
  370. <dl>
  371. <dt>DEBUG</dt>
  372. <dd>[entire GRASS]<br>
  373. sets level of debug message output (0: no debug messages)
  374. <div class="code"><pre>
  375. g.gisenv set=DEBUG=0
  376. </pre></div>
  377. <dt>DM_FORM_MODE</dt>
  378. <dd>[d.m]<br>
  379. sets default form mode (<tt>txt</tt> or <tt>gui</tt>)</dd>
  380. <dt>GISDBASE</dt>
  381. <dd>initial database</dd>
  382. <dt>GIS_LOCK</dt>
  383. <dd>lock ID to prevent parallel GRASS use,
  384. <br>process id of the start-up shell script</dd>
  385. <dt>GRASS_DB_ENCODING</dt>
  386. <dd>[d.what.vect/forms library]<br>
  387. encoding of query form (utf-8, ascii, iso8859-1, koi8-r)</dd>
  388. <dt>GRASS_GUI</dt>
  389. <dd>either <tt>text</tt> or <tt>gui</tt> to define non-/graphical startup.
  390. <br><br> Can also specify the name of the GUI to use,
  391. e.g. <tt>tcltk</tt>
  392. (<em><a href="gis.m.html">gis.m</a></em>), <tt>oldtcltk</tt>
  393. (<em><a href="d.m.html">d.m</a></em>) or <tt>wxpython</tt>
  394. (<em><a href="wxGUI.html">wxGUI</a></em>). Also exists as a shell
  395. environment variable. If this shell variable exists at GRASS
  396. startup, it will determine the GUI used. If it is not defined
  397. startup will default to the last GUI used.</dd>
  398. <dt>LOCATION</dt>
  399. <dd>full path to location directory</dd>
  400. <dt>LOCATION_NAME</dt>
  401. <dd>initial location name</dd>
  402. <dt>MAPSET</dt>
  403. <dd>initial mapset</dd>
  404. <dt>OVERWRITE</dt>
  405. <dd>[all modules]<br>
  406. toggles map overwrite.
  407. <ul>
  408. <li>0 - maps are protected (default),</li>
  409. <li>1 - maps with identical names will be overwritten.</li>
  410. </ul>
  411. This variable is automatically created
  412. by <em><a href="g.parser.html">g.parser</a></em> so that the
  413. <tt>--overwrite</tt> option will
  414. be inherited by dependant modules as the script runs. Setting either the
  415. GRASS_OVERWRITE environment variable or the OVERWRITE gisenv variable detailed
  416. below will cause maps with identical names to be overwritten.</dd>
  417. </dl>
  418. <a name="files"></a>
  419. <h2>GRASS-related Files</h2>
  420. <dl>
  421. <dt>$HOME/.grassrc7</dt>
  422. <dd>stores the GRASS variables (but not environment variables)</dd>
  423. <dt>$HOME/.grasslogin7</dt>
  424. <dd>stores the DBMI passwords in this hidden file.
  425. Only the file owner can access this file.</dd>
  426. <dt>$HOME/GIS_ERROR_LOG</dt>
  427. <dd>if this file exists then all GRASS error and warning messages are
  428. logged here. Applies to current user. To generate the file, use:
  429. <tt>touch $HOME/GIS_ERROR_LOG</tt><br>
  430. See also GIS_ERROR_LOG variable.</dd>
  431. </dl>
  432. <h3>SEE ALSO</h3>
  433. <em>
  434. <a href="displaydrivers.html">Display drivers</a>
  435. <br>
  436. <a href="g.gisenv.html">g.gisenv</a>,
  437. <a href="g.parser.html">g.parser</a>
  438. </em>
  439. <p>
  440. <i>Last changed: $Date$</i>
  441. <hr>
  442. <p>
  443. <a href=index.html>Help Index</a>
  444. <p>
  445. &copy; 2008 <a href="http://grass.osgeo.org">GRASS Development Team</a>
  446. </body>
  447. </html>