variables.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564
  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_XTERM</dt>
  191. <dd>lib/init/grass-xterm-wrapper<br>
  192. lib/init/grass-xterm-mac<br>
  193. set to any value (e.g. rxvt, aterm, gnome-terminal, konsole) to
  194. substitute 'x-terminal-emulator' or 'xterm'. The Mac OS X app
  195. startup defaults to an internal '$GISBASE/etc/grass-xterm-mac',
  196. which emulates the necessary xterm functionality in
  197. Terminal.app.</dd>
  198. <dt>GRASS_UI_TERM</dt>
  199. <dd>set to any value to use the terminal based parser.</dd>
  200. <dt>GRASS_VERSION</dt>
  201. <dd>reports the current version number (used by R-stats interface etc);
  202. should not be changed by user.</dd>
  203. <dt>GRASS_WIDTH</dt>
  204. <dd>[d.mon]<br>
  205. defines the width of GRASS monitor, see also GRASS_HEIGHT.</dd>
  206. <dt>GRASS_NO_GLX_PBUFFERS</dt>
  207. <dd>[nviz]<br>
  208. set to any value to disable the use of GLX Pbuffers.</dd>
  209. <dt>GRASS_NO_GLX_PIXMAPS</dt>
  210. <dd>[nviz]<br>
  211. Set to any value to disable the use of GLX Pixmaps.</dd>
  212. </dl>
  213. <a name="png"></a>
  214. <h3>List of selected GRASS PNG driver environment variables</h3>
  215. <blockquote>
  216. [ These variables control the function of the PNG driver ]
  217. </blockquote>
  218. See <a href="pngdriver.html">PNG driver</a> manual page for detailed
  219. list of the variables.
  220. <!--
  221. 2008/03 -- -- variables are described in PNG driver manual
  222. page. The link should be enough here.
  223. <P></P>
  224. <p>GRASS_PNGFILE
  225. <br>&nbsp; name of PNG output file. If it ends with ".ppm" a PPM file will be created.
  226. <p>GRASS_WIDTH
  227. <br>&nbsp; defines the width of GRASS monitor, see also GRASS_HEIGHT
  228. <p>GRASS_HEIGHT
  229. <br>&nbsp; defines the height of GRASS monitor, see also GRASS_WIDTH
  230. <p>GRASS_BACKGROUNDCOLOR
  231. <br>&nbsp; defines the background color of the image created by the PNG driver
  232. <p>GRASS_TRANSPARENT
  233. <br>&nbsp; if "TRUE", the image created by the PNG driver will have a
  234. transparent background
  235. <p>GRASS_PNG_COMPRESSION
  236. <br>&nbsp; compression level of PNG files (0 = none, 1 = fastest, 9 = best)
  237. <p>GRASS_TRUECOLOR
  238. <br>&nbsp; if "TRUE", the PNG driver generates a true-color image
  239. <p>GRASS_PNG_AUTO_WRITE
  240. <br>&nbsp; tells the PNG driver to write the image to a file whenever a
  241. client disconnects, rather than waiting until you stop the monitor
  242. <p>GRASS_PNG_READ
  243. <br>&nbsp; if "TRUE", the PNG driver will initialize the image from
  244. the contents of $GRASS_PNGFILE
  245. <p>GRASS_PNG_MAPPED
  246. <br>&nbsp; if "TRUE", the PNG driver will map $GRASS_PNGFILE as its framebuffer,
  247. rather than using memory; this only works with BMP files
  248. -->
  249. <a name="ps"></a>
  250. <h3>List of selected GRASS PS driver environment variables</h3>
  251. <blockquote>
  252. [ These variables control the function of the PS driver ]
  253. </blockquote>
  254. See <a href="psdriver.html">PS driver</a> manual page for detailed
  255. list of the variables.
  256. <!--
  257. 2008/03 -- -- variables are described in PS driver manual
  258. page. The link should be enough here.
  259. <P></P>
  260. <p>GRASS_PSFILE
  261. <br>&nbsp; name of output file. If it ends with ".eps" an EPS file
  262. will be created.
  263. <p>GRASS_PAPER <br>&nbsp; sets the screen dimensions and margins to
  264. fit a standard paper size, see also GRASS_WIDTH, GRASS_HEIGHT.
  265. <p>GRASS_WIDTH
  266. <br>&nbsp; defines the width of the screen, see also GRASS_HEIGHT
  267. <p>GRASS_HEIGHT
  268. <br>&nbsp; defines the height of the screen, see also GRASS_WIDTH
  269. <p>GRASS_TRUECOLOR
  270. <br>&nbsp; if "TRUE", the PS driver generates color output, otherwise
  271. monochrome.
  272. <p>GRASS_LANDSCAPE
  273. <br>&nbsp; if "TRUE", the screen is rotated 90 degrees
  274. counter-clockwise so that a "landscape" screen fits better on
  275. "portrait" paper.
  276. <p>GRASS_PS_HEADER
  277. <br>&nbsp; if "FALSE", the output is appended to any existing file,
  278. and no prolog or setup sections are generated.
  279. <p>GRASS_PS_TRAILER
  280. <br>&nbsp; if "FALSE", no trailer section is generated.
  281. -->
  282. <a name="html"></a>
  283. <h3>List of selected HTMLMAP driver environment variables</h3>
  284. <blockquote>
  285. [ These variables control the function of the HTMLMAP driver ]
  286. </blockquote>
  287. See <a href="htmlmapdriver.html">HTMLMAP driver</a> manual page for
  288. detailed list of the variables.
  289. <!--
  290. <a name="cairo"></a>
  291. <h3>List of selected Cairo driver environment variables</h3>
  292. <blockquote>
  293. [ These variables control the function of the Cairo driver ]
  294. </blockquote>
  295. See <a href="cairodriver.html">Cairo driver</a> manual page for
  296. detailed list of the variables.
  297. -->
  298. <a name="dirrend"></a>
  299. <h3>List of selected GRASS environment variables for direct rendering</h3>
  300. <blockquote>
  301. [ In addition to those which are understood by the
  302. <a href="pngdriver.html">PNG driver</a>, the following variables
  303. affect direct rendering. ]
  304. </blockquote>
  305. <dl>
  306. <dt>GRASS_RENDER_IMMEDIATE</dt>
  307. <dd>tells the raster library to use its built-in PNG/PS driver rather
  308. than connecting to an external monitor process using sockets. If
  309. GRASS_RENDER_IMMEDIATE=TRUE is set, there is no need to run
  310. <tt>d.mon&nbsp;start=PNG</tt>.</dd>
  311. <dt>GRASS_FONT</dt>
  312. <dd>specifies the font as either the name of a font from
  313. $GISBASE/etc/fontcap (or alternative fontcap file specified by GRASS_FONT_CAP),
  314. or alternatively the full path to a FreeType font file.</dd>
  315. <dt>GRASS_ENCODING</dt>
  316. <dd>the encoding to be assumed for text which is drawn using a
  317. freetype font; may be any encoding know to <em>iconv</em>.</dd>
  318. </dl>
  319. <a name="internal"></a>
  320. <h3>List of selected internal GRASS environment variables</h3>
  321. <blockquote>
  322. [ These variables are intended <b>for internal use only</b> by the GRASS
  323. software to facilitate communication between the GIS engine, GRASS scripts,
  324. and the GUI.
  325. The user should not set these in a GRASS session. They are meant to be set
  326. locally for specific commands. ]
  327. </blockquote>
  328. <dl>
  329. <dt>GRASS_OVERWRITE</dt>
  330. <dd>[all modules]<br>
  331. toggles map overwrite.
  332. <ul>
  333. <li>0 - maps are protected (default),</li>
  334. <li>1 - maps with identical names will be overwritten.</li>
  335. </ul>
  336. This variable is automatically created
  337. by <em><a href="g.parser.html">g.parser</a></em> so that the
  338. <tt>--overwrite</tt> option will
  339. be inherited by dependant modules as the script runs. Setting either the
  340. GRASS_OVERWRITE environment variable or the OVERWRITE gisenv variable detailed
  341. below will cause maps with identical names to be overwritten.</dd>
  342. <dt>GRASS_VERBOSE</dt>
  343. <dd>[all modules]<br>
  344. toggles verbosity level
  345. <ul>
  346. <li>0 - only errors and warnings are printed</li>
  347. <li>1 - progress messages are printed (percent complete)</li>
  348. <li>2 - all module messages are printed</li>
  349. <li>3 - additional verbose messages are printed</li>
  350. </ul>
  351. This variable is automatically created by <em><a href="g.parser.html">g.parser</a></em>
  352. so that the <tt>--verbose</tt> or <tt>--quiet</tt> flags will be inherited
  353. by dependant modules as the script runs.</dd>
  354. <dt>GRASS_REGION</dt>
  355. <dd>[libgis]<br>
  356. override region settings, separate parameters with a ";". Format
  357. is the same as in the WIND region settings file. Otherwise use is the same as
  358. WIND_OVERRIDE.</dd>
  359. <dt>WIND_OVERRIDE</dt>
  360. <dd>[libgis]<br>
  361. it causes programs to use the specified named region (created with
  362. e.g. <tt>g.region save=...</tt>) to be used as the current region, instead of
  363. the region from the WIND file.<br><br>
  364. This allows programs such as the GUI to run external commands on an
  365. alternate region without having to modify the WIND file then change it
  366. back afterwards.</dd>
  367. </dl>
  368. <a name="gisenv"></a>
  369. <h2>List of selected GRASS gisenv variables</h2>
  370. <blockquote>
  371. [ Use <em>g.gisenv</em> to get/set/unset/change them ]
  372. </blockquote>
  373. <dl>
  374. <dt>DEBUG</dt>
  375. <dd>[entire GRASS]<br>
  376. sets level of debug message output (0: no debug messages)
  377. <div class="code"><pre>
  378. g.gisenv set=DEBUG=0
  379. </pre></div>
  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>wxpython</tt>
  392. (<em><a href="wxGUI.html">wxGUI</a></em>). Also exists as a shell
  393. environment variable. If this shell variable exists at GRASS
  394. startup, it will determine the GUI used. If it is not defined
  395. startup will default to the last GUI used.</dd>
  396. <dt>LOCATION</dt>
  397. <dd>full path to location directory</dd>
  398. <dt>LOCATION_NAME</dt>
  399. <dd>initial location name</dd>
  400. <dt>MAPSET</dt>
  401. <dd>initial mapset</dd>
  402. <dt>OVERWRITE</dt>
  403. <dd>[all modules]<br>
  404. toggles map overwrite.
  405. <ul>
  406. <li>0 - maps are protected (default),</li>
  407. <li>1 - maps with identical names will be overwritten.</li>
  408. </ul>
  409. This variable is automatically created
  410. by <em><a href="g.parser.html">g.parser</a></em> so that the
  411. <tt>--overwrite</tt> option will
  412. be inherited by dependant modules as the script runs. Setting either the
  413. GRASS_OVERWRITE environment variable or the OVERWRITE gisenv variable detailed
  414. below will cause maps with identical names to be overwritten.</dd>
  415. </dl>
  416. <a name="files"></a>
  417. <h2>GRASS-related Files</h2>
  418. <dl>
  419. <dt>$HOME/.grassrc7</dt>
  420. <dd>stores the GRASS variables (but not environment variables)</dd>
  421. <dt>$HOME/.grasslogin7</dt>
  422. <dd>stores the DBMI passwords in this hidden file.
  423. Only the file owner can access this file.</dd>
  424. <dt>$HOME/GIS_ERROR_LOG</dt>
  425. <dd>if this file exists then all GRASS error and warning messages are
  426. logged here. Applies to current user. To generate the file, use:
  427. <tt>touch $HOME/GIS_ERROR_LOG</tt><br>
  428. See also GIS_ERROR_LOG variable.</dd>
  429. </dl>
  430. <h3>SEE ALSO</h3>
  431. <em>
  432. <a href="displaydrivers.html">Display drivers</a>
  433. <br>
  434. <a href="g.gisenv.html">g.gisenv</a>,
  435. <a href="g.parser.html">g.parser</a>
  436. </em>
  437. <p>
  438. <i>Last changed: $Date$</i>
  439. <hr>
  440. <p>
  441. <a href=index.html>Help Index</a>
  442. <p>
  443. &copy; 2008 <a href="http://grass.osgeo.org">GRASS Development Team</a>
  444. </body>
  445. </html>