variables.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572
  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_FONT_CAP</dt>
  108. <dd>[g.mkfontcap, d.font, display drivers]<br>
  109. specifies an alternative location (to $GISBASE/etc/fontcap) for
  110. the font configuration file.</dd>
  111. <dt>GRASS_GNUPLOT</dt>
  112. <dd>[<!-- m.svfit, s.probplt, s.sv -->i.spectral]<br>
  113. program to use for plotting <em>gnuplot</em> data.</dd>
  114. <dt>GRASS_GUI</dt>
  115. <dd>either <tt>text</tt> or <tt>gui</tt> to define non-/graphical startup.
  116. <br><br>
  117. Can also specify the name of the GUI to use, e.g. <tt>wxpython</tt>
  118. (<em><a href="wxGUI.html">wxGUI</a></em>). Also exists as a GRASS
  119. gisenv variable (see below). If this shell variable exists at GRASS
  120. startup, it will determine the GUI used. If it is not defined startup
  121. will default to the last GUI used.</dd>
  122. <dt>GRASS_HEIGHT</dt>
  123. <dd>[d.mon]<br>
  124. defines the height of GRASS monitor, see also GRASS_WIDTH.</dd>
  125. <dt>GRASS_HTML_BROWSER</dt>
  126. <dd>[init.sh, wxgui]<br>
  127. defines name of HTML browser. For most platforms this should be
  128. an executable in your PATH, or the full path to an executable.<br><br>
  129. Mac OS X runs applications differently from the CLI.
  130. Therefore, GRASS_HTML_BROWSER should be the application's signature,
  131. which is a domain-like name, just reversed, i.e. com.apple.Safari. To
  132. find an application's signature, type the following in a Terminal
  133. (fill in the path to the application you are interested in, for
  134. example: /Applications/Safari.app):<br> &nbsp; &nbsp; <code>grep -A 1
  135. &quot;CFBundleIdentifier&quot;</code> <i>/path/to/application.app</i><code>/Contents/Info.plist</code><br>
  136. &nbsp; The signature is the &lt;string&gt; following the &lt;key&gt;,
  137. without the bracketing &lt;string&gt; tags.</dd>
  138. <dt>G_INFO_FORMAT_STANDARD</dt>
  139. <dd>[init.sh, wxgui]<br>
  140. sets percentage output and message formatting style to standard formatting.</dd>
  141. <dt>G_INFO_FORMAT_GUI</dt>
  142. <dd>[init.sh, wxgui]<br>
  143. sets percentage output and message formatting style to GUI formatting.</dd>
  144. <dt>G_INFO_FORMAT_SILENT</dt>
  145. <dd>[init.sh, wxgui]<br>
  146. disables percentage output and error messages.</dd>
  147. <dt>G_INFO_FORMAT_PLAIN</dt>
  148. <dd>[init.sh, wxgui]<br>
  149. sets percentage output and message formatting style to ASCII output without rewinding control characters.</dd>
  150. <dt>GRASS_INT_ZLIB</dt>
  151. <dd>[libgis]<br>
  152. if the environment variable GRASS_INT_ZLIB exists, new compressed
  153. rasters will be compressed using zlib instead of RLE
  154. compression. Such rasters will have a <tt>compressed</tt> value of 2 in the
  155. cellhd file.
  156. <br><br>
  157. Obviously, decompression is controlled by the
  158. raster's <tt>compressed</tt> value, not the environment variable.</dd>
  159. <dt>GRASS_MESSAGE_FORMAT</dt>
  160. <dd>[various modules]<br>
  161. maybe set to either <tt>standard</tt> or <tt>gui</tt> (normally
  162. GRASS takes care).</dd>
  163. <dt>GRASS_MOUSE_BUTTON</dt>
  164. <dd>[various modules]<br>
  165. swaps mouse buttons for two-button or left-handed mice. Its value
  166. has three digits 1, 2, and 3, which represent default left, middle, and right
  167. buttons respectively. Setting to <tt>132</tt> will swap middle and right buttons. Note
  168. that this variable should be set before a display driver is initialized (e.g.,
  169. <tt>d.mon x0</tt>).</dd>
  170. <dt>GRASS_PAGER</dt>
  171. <dd>[various modules]<br>
  172. maybe set to either <tt>less</tt> or <tt>more</tt>.</dd>
  173. <dt>GRASS_PERL</dt>
  174. <dd>[used during install process for generating man pages]<br>
  175. set Perl with path.</dd>
  176. <dt>GRASS_RND_SEED</dt>
  177. <dd>set random seed
  178. for <em><a href="r.mapcalc.html">r.mapcalc</a></em> rand()
  179. function.</dd>
  180. <!-- HB Sept 2005: I don't think this exists anymore:
  181. <p>GRASS_STDERR
  182. <br>&nbsp; set to any value to prevent user mail on error
  183. -->
  184. <dt>GRASS_SH</dt>
  185. <dd>[shell scripts on Windows]<br>
  186. path to bourne shell interpreter used to run shell scripts.</dd>
  187. <dt>GRASS_PYTHON</dt>
  188. <dd>[wxGUI, Python SWIG]<br>
  189. set to override Python executable.</dd>
  190. <dt>GRASS_TCLSH</dt>
  191. <dd>[nviz]<br>
  192. set tclsh shell name to override 'tclsh'.</dd>
  193. <dt>GRASS_XTERM</dt>
  194. <dd>lib/init/grass-xterm-wrapper<br>
  195. lib/init/grass-xterm-mac<br>
  196. set to any value (e.g. rxvt, aterm, gnome-terminal, konsole) to
  197. substitute 'x-terminal-emulator' or 'xterm'. The Mac OS X app
  198. startup defaults to an internal '$GISBASE/etc/grass-xterm-mac',
  199. which emulates the necessary xterm functionality in
  200. Terminal.app.</dd>
  201. <dt>GRASS_UI_TERM</dt>
  202. <dd>set to any value to use the terminal based parser.</dd>
  203. <dt>GRASS_VERSION</dt>
  204. <dd>reports the current version number (used by R-stats interface etc);
  205. should not be changed by user.</dd>
  206. <dt>GRASS_WIDTH</dt>
  207. <dd>[d.mon]<br>
  208. defines the width of GRASS monitor, see also GRASS_HEIGHT.</dd>
  209. <dt>GRASS_WISH</dt>
  210. <dd>[nviz, Tcl/Tk programs]<br>
  211. set wish shell name to override 'wish'.</dd>
  212. <dt>GRASS_NO_GLX_PBUFFERS</dt>
  213. <dd>[nviz]<br>
  214. set to any value to disable the use of GLX Pbuffers.</dd>
  215. <dt>GRASS_NO_GLX_PIXMAPS</dt>
  216. <dd>[nviz]<br>
  217. Set to any value to disable the use of GLX Pixmaps.</dd>
  218. </dl>
  219. <a name="png"></a>
  220. <h3>List of selected GRASS PNG driver environment variables</h3>
  221. <blockquote>
  222. [ These variables control the function of the PNG driver ]
  223. </blockquote>
  224. See <a href="pngdriver.html">PNG driver</a> manual page for detailed
  225. list of the variables.
  226. <!--
  227. 2008/03 -- -- variables are described in PNG driver manual
  228. page. The link should be enough here.
  229. <P></P>
  230. <p>GRASS_PNGFILE
  231. <br>&nbsp; name of PNG output file. If it ends with ".ppm" a PPM file will be created.
  232. <p>GRASS_WIDTH
  233. <br>&nbsp; defines the width of GRASS monitor, see also GRASS_HEIGHT
  234. <p>GRASS_HEIGHT
  235. <br>&nbsp; defines the height of GRASS monitor, see also GRASS_WIDTH
  236. <p>GRASS_BACKGROUNDCOLOR
  237. <br>&nbsp; defines the background color of the image created by the PNG driver
  238. <p>GRASS_TRANSPARENT
  239. <br>&nbsp; if "TRUE", the image created by the PNG driver will have a
  240. transparent background
  241. <p>GRASS_PNG_COMPRESSION
  242. <br>&nbsp; compression level of PNG files (0 = none, 1 = fastest, 9 = best)
  243. <p>GRASS_TRUECOLOR
  244. <br>&nbsp; if "TRUE", the PNG driver generates a true-color image
  245. <p>GRASS_PNG_AUTO_WRITE
  246. <br>&nbsp; tells the PNG driver to write the image to a file whenever a
  247. client disconnects, rather than waiting until you stop the monitor
  248. <p>GRASS_PNG_READ
  249. <br>&nbsp; if "TRUE", the PNG driver will initialize the image from
  250. the contents of $GRASS_PNGFILE
  251. <p>GRASS_PNG_MAPPED
  252. <br>&nbsp; if "TRUE", the PNG driver will map $GRASS_PNGFILE as its framebuffer,
  253. rather than using memory; this only works with BMP files
  254. -->
  255. <a name="ps"></a>
  256. <h3>List of selected GRASS PS driver environment variables</h3>
  257. <blockquote>
  258. [ These variables control the function of the PS driver ]
  259. </blockquote>
  260. See <a href="psdriver.html">PS driver</a> manual page for detailed
  261. list of the variables.
  262. <!--
  263. 2008/03 -- -- variables are described in PS driver manual
  264. page. The link should be enough here.
  265. <P></P>
  266. <p>GRASS_PSFILE
  267. <br>&nbsp; name of output file. If it ends with ".eps" an EPS file
  268. will be created.
  269. <p>GRASS_PAPER <br>&nbsp; sets the screen dimensions and margins to
  270. fit a standard paper size, see also GRASS_WIDTH, GRASS_HEIGHT.
  271. <p>GRASS_WIDTH
  272. <br>&nbsp; defines the width of the screen, see also GRASS_HEIGHT
  273. <p>GRASS_HEIGHT
  274. <br>&nbsp; defines the height of the screen, see also GRASS_WIDTH
  275. <p>GRASS_TRUECOLOR
  276. <br>&nbsp; if "TRUE", the PS driver generates color output, otherwise
  277. monochrome.
  278. <p>GRASS_LANDSCAPE
  279. <br>&nbsp; if "TRUE", the screen is rotated 90 degrees
  280. counter-clockwise so that a "landscape" screen fits better on
  281. "portrait" paper.
  282. <p>GRASS_PS_HEADER
  283. <br>&nbsp; if "FALSE", the output is appended to any existing file,
  284. and no prolog or setup sections are generated.
  285. <p>GRASS_PS_TRAILER
  286. <br>&nbsp; if "FALSE", no trailer section is generated.
  287. -->
  288. <a name="html"></a>
  289. <h3>List of selected HTMLMAP driver environment variables</h3>
  290. <blockquote>
  291. [ These variables control the function of the HTMLMAP driver ]
  292. </blockquote>
  293. See <a href="htmlmapdriver.html">HTMLMAP driver</a> manual page for
  294. detailed list of the variables.
  295. <!--
  296. <a name="cairo"></a>
  297. <h3>List of selected Cairo driver environment variables</h3>
  298. <blockquote>
  299. [ These variables control the function of the Cairo driver ]
  300. </blockquote>
  301. See <a href="cairodriver.html">Cairo driver</a> manual page for
  302. detailed list of the variables.
  303. -->
  304. <a name="dirrend"></a>
  305. <h3>List of selected GRASS environment variables for direct rendering</h3>
  306. <blockquote>
  307. [ In addition to those which are understood by the
  308. <a href="pngdriver.html">PNG driver</a>, the following variables
  309. affect direct rendering. ]
  310. </blockquote>
  311. <dl>
  312. <dt>GRASS_RENDER_IMMEDIATE</dt>
  313. <dd>tells the raster library to use its built-in PNG/PS driver rather
  314. than connecting to an external monitor process using sockets. If
  315. GRASS_RENDER_IMMEDIATE=TRUE is set, there is no need to run
  316. <tt>d.mon&nbsp;start=PNG</tt>.</dd>
  317. <dt>GRASS_FONT</dt>
  318. <dd>specifies the font as either the name of a font from
  319. $GISBASE/etc/fontcap (or alternative fontcap file specified by GRASS_FONT_CAP),
  320. or alternatively the full path to a FreeType font file.</dd>
  321. <dt>GRASS_ENCODING</dt>
  322. <dd>the encoding to be assumed for text which is drawn using a
  323. freetype font; may be any encoding know to <em>iconv</em>.</dd>
  324. </dl>
  325. <a name="internal"></a>
  326. <h3>List of selected internal GRASS environment variables</h3>
  327. <blockquote>
  328. [ These variables are intended <b>for internal use only</b> by the GRASS
  329. software to facilitate communication between the GIS engine, GRASS scripts,
  330. and the GUI.
  331. The user should not set these in a GRASS session. They are meant to be set
  332. locally for specific commands. ]
  333. </blockquote>
  334. <dl>
  335. <dt>GRASS_OVERWRITE</dt>
  336. <dd>[all modules]<br>
  337. toggles map overwrite.
  338. <ul>
  339. <li>0 - maps are protected (default),</li>
  340. <li>1 - maps with identical names will be overwritten.</li>
  341. </ul>
  342. This variable is automatically created
  343. by <em><a href="g.parser.html">g.parser</a></em> so that the
  344. <tt>--overwrite</tt> option will
  345. be inherited by dependant modules as the script runs. Setting either the
  346. GRASS_OVERWRITE environment variable or the OVERWRITE gisenv variable detailed
  347. below will cause maps with identical names to be overwritten.</dd>
  348. <dt>GRASS_VERBOSE</dt>
  349. <dd>[all modules]<br>
  350. toggles verbosity level
  351. <ul>
  352. <li>0 - only errors and warnings are printed</li>
  353. <li>1 - progress messages are printed (percent complete)</li>
  354. <li>2 - all module messages are printed</li>
  355. <li>3 - additional verbose messages are printed</li>
  356. </ul>
  357. This variable is automatically created by <em><a href="g.parser.html">g.parser</a></em>
  358. so that the <tt>--verbose</tt> or <tt>--quiet</tt> flags will be inherited
  359. by dependant modules as the script runs.</dd>
  360. <dt>GRASS_REGION</dt>
  361. <dd>[libgis]<br>
  362. override region settings, separate parameters with a ";". Format
  363. is the same as in the WIND region settings file. Otherwise use is the same as
  364. WIND_OVERRIDE.</dd>
  365. <dt>WIND_OVERRIDE</dt>
  366. <dd>[libgis]<br>
  367. it causes programs to use the specified named region (created with
  368. e.g. <tt>g.region save=...</tt>) to be used as the current region, instead of
  369. the region from the WIND file.<br><br>
  370. This allows programs such as the GUI to run external commands on an
  371. alternate region without having to modify the WIND file then change it
  372. back afterwards.</dd>
  373. </dl>
  374. <a name="gisenv"></a>
  375. <h2>List of selected GRASS gisenv variables</h2>
  376. <blockquote>
  377. [ Use <em>g.gisenv</em> to get/set/unset/change them ]
  378. </blockquote>
  379. <dl>
  380. <dt>DEBUG</dt>
  381. <dd>[entire GRASS]<br>
  382. sets level of debug message output (0: no debug messages)
  383. <div class="code"><pre>
  384. g.gisenv set=DEBUG=0
  385. </pre></div>
  386. <dt>GISDBASE</dt>
  387. <dd>initial database</dd>
  388. <dt>GIS_LOCK</dt>
  389. <dd>lock ID to prevent parallel GRASS use,
  390. <br>process id of the start-up shell script</dd>
  391. <dt>GRASS_DB_ENCODING</dt>
  392. <dd>[d.what.vect/forms library]<br>
  393. encoding of query form (utf-8, ascii, iso8859-1, koi8-r)</dd>
  394. <dt>GRASS_GUI</dt>
  395. <dd>either <tt>text</tt> or <tt>gui</tt> to define non-/graphical startup.
  396. <br><br> Can also specify the name of the GUI to use,
  397. e.g. <tt>wxpython</tt>
  398. (<em><a href="wxGUI.html">wxGUI</a></em>). Also exists as a shell
  399. environment variable. If this shell variable exists at GRASS
  400. startup, it will determine the GUI used. If it is not defined
  401. startup will default to the last GUI used.</dd>
  402. <dt>LOCATION</dt>
  403. <dd>full path to location directory</dd>
  404. <dt>LOCATION_NAME</dt>
  405. <dd>initial location name</dd>
  406. <dt>MAPSET</dt>
  407. <dd>initial mapset</dd>
  408. <dt>OVERWRITE</dt>
  409. <dd>[all modules]<br>
  410. toggles map overwrite.
  411. <ul>
  412. <li>0 - maps are protected (default),</li>
  413. <li>1 - maps with identical names will be overwritten.</li>
  414. </ul>
  415. This variable is automatically created
  416. by <em><a href="g.parser.html">g.parser</a></em> so that the
  417. <tt>--overwrite</tt> option will
  418. be inherited by dependant modules as the script runs. Setting either the
  419. GRASS_OVERWRITE environment variable or the OVERWRITE gisenv variable detailed
  420. below will cause maps with identical names to be overwritten.</dd>
  421. </dl>
  422. <a name="files"></a>
  423. <h2>GRASS-related Files</h2>
  424. <dl>
  425. <dt>$HOME/.grassrc7</dt>
  426. <dd>stores the GRASS variables (but not environment variables)</dd>
  427. <dt>$HOME/.grasslogin7</dt>
  428. <dd>stores the DBMI passwords in this hidden file.
  429. Only the file owner can access this file.</dd>
  430. <dt>$HOME/GIS_ERROR_LOG</dt>
  431. <dd>if this file exists then all GRASS error and warning messages are
  432. logged here. Applies to current user. To generate the file, use:
  433. <tt>touch $HOME/GIS_ERROR_LOG</tt><br>
  434. See also GIS_ERROR_LOG variable.</dd>
  435. </dl>
  436. <h3>SEE ALSO</h3>
  437. <em>
  438. <a href="displaydrivers.html">Display drivers</a>
  439. <br>
  440. <a href="g.gisenv.html">g.gisenv</a>,
  441. <a href="g.parser.html">g.parser</a>
  442. </em>
  443. <p>
  444. <i>Last changed: $Date$</i>
  445. <hr>
  446. <p>
  447. <a href=index.html>Help Index</a>
  448. <p>
  449. &copy; 2008 <a href="http://grass.osgeo.org">GRASS Development Team</a>
  450. </body>
  451. </html>