123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497 |
- <!-- meta page description: GRASS variables and environment variables -->
- There are two types of variables:
- <ul>
- <li><a href="#enviro">shell environment</a> variables,</li>
- <li><a href="#gisenv">GRASS gisenv</a> variables.</li>
- </ul>
- There are a number of <i>shell</i> environment variable groups:
- <ul>
- <li><a href="#rendering">variables for rendering</a></li>
- <li><a href="#internal">variables for internal use</a></li>
- </ul>
- <i>Note:</i> Any setting which needs to be modifiable by a GRASS module
- (e.g. MONITOR by <em><a href="d.mon.html">d.mon</a></em>) has to be a GRASS
- gisenv variable.
- <h2>Setting shell environment variables</h2>
- Setting shell environment variables depends on the shell being used:
- <br><br>
- Bash:
- <div class="code"><pre>
- export VARIABLE=value
- </pre></div>
- Csh:
- <div class="code"><pre>
- setenv VARIABLE value
- </pre></div>
- Cmd.exe (Windows):
- <div class="code"><pre>
- set VARIABLE=value
- </pre></div>
- To set up shell environment variables permanently:
- <ul>
- <li>
- To get personal BASH shell definitions (aliases, color listing option, ...)
- into GRASS, store them in:<br>
- <tt>$HOME/.grass.bashrc</tt></li>
- <li>
- To get personal CSH shell definitions (aliases, color listing option, ...)
- into GRASS, store them in:<br>
- <tt>$HOME/.grass.cshrc</tt></li>
- </ul>
- <h2>Setting GRASS gisenv variables</h2>
- Use <em><a href="g.gisenv.html">g.gisenv</a></em> within GRASS. This permanently
- predefines GRASS variables in the <tt>.grass7/rc</tt> file.
- <br><br>
- Usage:
- <div class="code"><pre>
- g.gisenv set="VARIABLE=VALUE"
- </pre></div>
- It looks unusual with two equals signs, but <em>g.gisenv</em> serves dual duty for
- getting and setting GRASS variables.
- <p>If the user just specifies a variable name, it defaults to <b>get</b> mode.
- For example:
- <div class="code"><pre>
- g.gisenv MAPSET
- PERMANENT
- </pre></div>
- <a name="enviro"></a>
- <h2>List of selected (GRASS related) shell environment variables</h2>
- <blockquote>
- [ To be set from the terminal shell or startup scripts ]
- </blockquote>
- <dl>
-
- <dt>GISBASE</dt>
- <dd>directory where GRASS lives. This is set automatically by the
- startup script.</dd>
-
- <dt>GISRC</dt>
- <dd>name of <tt>.grass7/rc</tt> file. Defines the system wide value
- while in a GRASS session.</dd>
-
- <dt>GRASS_ADDON_PATH</dt>
- <dd>[grass startup script, g.extension]<br>
- specifies additional path(s) containing local and/or custom GRASS
- modules extra to the standard distribution.</dd>
- <dt>GRASS_ADDON_BASE</dt>
- <dd>[grass startup script]<br> allows to specify additional GISBASE
- for local GRASS modules (normally installed as GRASS Addons
- by <tt>g.extension</tt> module) extra to standard
- distribution. The default on GNU/Linux
- is <tt>$HOME/.grass7/addons</tt>, on MS
- Windows <tt>$APPDATA\GRASS7\addons</tt>.</dd>
-
- <dt>GRASS_ADDON_ETC</dt>
- <dd>[libgis, g.findetc]<br>
- specify paths where support files (etc/) may be found external to
- standard distribution.</dd>
-
- <dt>GRASS_BATCH_JOB</dt>
- <dd>defines the name (path) of a shell script to be processed as
- batch job.</dd>
- <dt>GIS_ERROR_LOG</dt>
- <dd>If set, GIS_ERROR_LOG should be the absolute path to the log
- file (a relative path will be interpreted relative to the process'
- cwd, not the cwd at the point the user set the variable). If not
- set, <tt>$HOME/GIS_ERROR_LOG</tt> is used instead. The file will
- only be used if it already exists.</dd>
- <dt>GRASS_ERROR_MAIL</dt>
- <dd>set to any value to send user mail on an error or warning that
- happens while stderr is being redirected.</dd>
-
- <dt>GRASS_FONT</dt>
- <dd>[display drivers]<br>
- specifies the font as either the name of a font from
- <tt>$GISBASE/etc/fontcap</tt> (or alternative fontcap file
- specified by GRASS_FONT_CAP), or alternatively the full path to a
- FreeType font file.</dd>
-
- <dt>GRASS_ENCODING</dt>
- <dd>[display drivers]<br>
- the encoding to be assumed for text which is drawn using a
- freetype font; may be any encoding know to <em>iconv</em>.</dd>
- <dt>GRASS_FONT_CAP</dt>
- <dd>[g.mkfontcap, d.font, display drivers]<br>
- specifies an alternative location (to <tt>$GISBASE/etc/fontcap</tt>) for
- the font configuration file.</dd>
-
- <dt>GRASS_GNUPLOT</dt>
- <dd>[<!-- m.svfit, s.probplt, s.sv -->i.spectral]<br>
- program to use for plotting <em>gnuplot</em> data.</dd>
-
- <dt>GRASS_GUI</dt>
- <dd>either <tt>text</tt> (text user interface), <tt>gtext</tt> (text
- user interface with GUI welcome screen), or <tt>gui</tt> (graphical
- user interface) to define non-/graphical startup. Can also specify
- the name of the GUI to use, e.g. <tt>wxpython</tt>
- (<em><a href="wxGUI.html">wxGUI</a></em>). Also exists as a GRASS
- gisenv variable (see below). If this shell variable exists at GRASS
- startup, it will determine the GUI used. If it is not defined
- startup will default to the last GUI used.</dd>
-
- <dt>GRASS_HTML_BROWSER</dt>
- <dd>[init.sh, wxgui]<br> defines name of HTML browser. For most
- platforms this should be an executable in your PATH, or the full
- path to an executable.<br> Mac OS X runs applications differently
- from the CLI. Therefore, GRASS_HTML_BROWSER should be the
- application's signature, which is a domain-like name, just
- reversed, i.e. com.apple.Safari. To find an application's
- signature, type the following in a Terminal (fill in the path to
- the application you are interested in, for example:
- /Applications/Safari.app):<br> <code>grep -A 1
- "CFBundleIdentifier"</code> <i>/path/to/application.app</i><code>/Contents/Info.plist</code><br>
- The signature is the <string> following the
- <key>, without the bracketing <string> tags.</dd>
- <dt>GRASS_INT_ZLIB</dt>
- <dd>[libgis]<br> if the environment variable GRASS_INT_ZLIB exists,
- new compressed <i>integer</i> (CELL type) raster maps will be compressed
- using zlib instead of RLE compression. Such rasters will have a <tt>compressed</tt>
- value of 2 in the cellhd file.
- <br><br>
- Obviously, decompression is controlled by the
- raster's <tt>compressed</tt> value, not the environment variable.</dd>
-
- <dt>GRASS_MESSAGE_FORMAT</dt>
- <dd>[various modules, wxGUI]<br>
- it may be set to either
- <ul>
- <li><tt>standard</tt> - sets percentage output and message
- formatting style to standard formatting,</li>
- <li><tt>gui</tt> - sets percentage output and message formatting
- style to GUI formatting,</li>
- <li><tt>silent</tt> - disables percentage output and error
- messages,</li>
- <li><tt>plain</tt> - sets percentage output and message
- formatting style to ASCII output without rewinding control
- characters.</li>
- </ul></dd>
-
- <dt>GRASS_MOUSE_BUTTON</dt>
- <dd>[various modules]<br> swaps mouse buttons for two-button or
- left-handed mice. Its value has three digits 1, 2, and 3, which
- represent default left, middle, and right buttons
- respectively. Setting to <tt>132</tt> will swap middle and right
- buttons. Note that this variable should be set before a display
- driver is initialized (e.g.,
- <tt>d.mon x0</tt>).</dd>
-
- <dt>GRASS_PAGER</dt>
- <dd>[various modules]<br>
- it may be set to either <tt>less</tt>, <tt>more</tt>, or <tt>cat</tt>.</dd>
-
- <dt>GRASS_PERL</dt>
- <dd>[used during install process for generating man pages]<br>
- set Perl with path.</dd>
-
- <dt>GRASS_RND_SEED</dt>
- <dd>set random seed
- for <em><a href="r.mapcalc.html">r.mapcalc</a></em> rand()
- function.</dd>
- <dt>GRASS_SKIP_MAPSET_OWNER_CHECK</dt>
- <dd>By default it is not possible to work with MAPSETs that are
- not owned by current user. Setting this variable to any non-empty value
- allows the check to be skipped.</dd>
- <dt>GRASS_SH</dt>
- <dd>[shell scripts on Windows]<br>
- path to bourne shell interpreter used to run shell scripts.</dd>
- <dt>GRASS_SIGSEGV_ON_ERROR</dt>
- <dd>Raise SIGSEGV if an error occures]<br>
- This variable can be set for debugging purpose. The call
- of G_fatal_error() will end in a segmentation violation. GDB can be used
- to trace the source of the error.</dd>
- <dt>GRASS_PYTHON</dt>
- <dd>[wxGUI, Python Ctypes]<br>
- set to override Python executable.<br>
- On Mac OS X this should be the <tt>pythonw</tt> executable for the
- wxGUI to work.</dd>
-
- <dt>GRASS_VECTOR_LOWMEM</dt>
- <dd>[vectorlib]<br>
- If the environment variable GRASS_VECTOR_LOWMEM exists, memory
- consumption will be reduced when building vector topology
- support structures. Recommended for creating large vectors.</dd>
- <dt>GRASS_VECTOR_OGR</dt>
- <dd>[vectorlib, v.external.out]<br> If the environment variable
- GRASS_VECTOR_OGR exists and vector output format defined
- by <em><a href="v.external.out.html">v.external.out</a></em> is
- PostgreSQL, vector data is written by OGR data provider even
- the native PostGIS data provider is available.</dd>
- <dt>GRASS_VECTOR_EXTERNAL_IMMEDIATE</dt>
- <dd>[vectorlib, v.external.out]<br> If the environment variable
- GRASS_VECTOR_EXTERNAL_IMMEDIATE exists and vector output format
- defined
- by <em><a href="v.external.out.html">v.external.out</a></em> is
- non-native, vector features are written to output external
- datasource immediately. By default, the vector library writes
- output data to a temporary vector map in native format and when
- closing the map, the features are transfered to output external
- datasource. Note: if output vector format is topological PostGIS
- format, then the vector library writes features immediately to output
- database (in this case GRASS_VECTOR_EXTERNAL_IMMEDIATE is ignored).</dd>
- <dt>GRASS_VECTOR_EXTERNAL_IGNORE</dt>
- <dd>[vectorlib]<br> If the environment variable
- GRASS_VECTOR_EXTERNAL_IGNORE exists, output vector format defined
- by <em><a href="v.external.out.html">v.external.out</a></em> is
- ignored. The format is always native.</dd>
- <dt>GRASS_VECTOR_TEMPORARY</dt>
- <dd>[vectorlib]<br> If the environment variable
- GRASS_VECTOR_TEMPORARY exists, vector library will operate with
- temporary vector maps. New vector maps will be created
- in <tt>$MAPSET/.tmp/$HOSTNAME/vector</tt>, existing vector maps
- will be read also from this directory. Note that temporary vector
- maps are not visible to the user
- via <em><a href="g.list.html">g.list</a></em>. They are used
- internally by the GRASS modules and deleted automatically when the
- map is closed or GRASS session quited. Note that this variable is
- dedicated for internal use only.
- </dd>
-
- <dt>GRASS_WXBUNDLED</dt>
- <dd>[wxGUI]<br>
- set to tell wxGUI that a bundled wxPython will be used.<br>
- When set, the wxGUI will not check the wxPython version, as this
- function is incompatible with a bundled wxPython. It is up to the
- packager to make sure that a compatible wxPython version is bundled.</dd>
-
- <dt>GRASS_XTERM</dt>
- <dd>[lib/init/grass-xterm-wrapper, lib/init/grass-xterm-mac]<br>
- set to any value (e.g. rxvt, aterm, gnome-terminal, konsole) to
- substitute 'x-terminal-emulator' or 'xterm'. The Mac OS X app
- startup defaults to an internal '$GISBASE/etc/grass-xterm-mac',
- which emulates the necessary xterm functionality in
- Terminal.app.</dd>
-
- <dt>GRASS_UI_TERM</dt>
- <dd>set to any value to use the terminal based parser.</dd>
- <dt>GRASS_VERSION</dt>
- <dd>reports the current version number (used by R-stats interface etc);
- should not be changed by user.</dd>
-
- <dt>GRASS_NO_GLX_PBUFFERS</dt>
- <dd>[nviz]<br>
- set to any value to disable the use of GLX Pbuffers.</dd>
-
- <dt>GRASS_NO_GLX_PIXMAPS</dt>
- <dd>[nviz]<br>
- Set to any value to disable the use of GLX Pixmaps.</dd>
- <dt>OMP_NUM_THREADS</dt>
- <dd>[OpenMP]<br>
- If OpenMP support is enabled this limits the number of threads.
- The default is set to the number of CPUs on the system.
- Setting to '1' effectively disables parallel processing.</dd>
- </dl>
- <a name="rendering"></a>
- <h3>List of selected GRASS environment variables for rendering</h3>
- <blockquote>
- [ In addition to those which are understood by specific <em>GRASS display
- drivers</em>, the following variables affect rendering. ]
- </blockquote>
- <dl>
- <dt>GRASS_RENDER_IMMEDIATE</dt>
- <dd>tells the display library which driver to use; possible
- values: <em><a href="cairodriver.html">cairo</a></em>, <em><a href="pngdriver.html">png</a></em>, <em><a href="psdriver.html">ps</a></em>
- or <em><a href="htmldriver.html">html</a></em></dd>
-
- <dt>GRASS_WIDTH</dt>
- <dd>defines the width of output image (default is 640).</dd>
-
- <dt>GRASS_HEIGHT</dt>
- <dd>defines the height of output image (default is 480).</dd>
-
- <dt>GRASS_FRAME</dt>
- <dd>contains 4 coordinates, <em>top,bottom,left,right</em> (pixel values), defining the initial frame.</dd>
- <dt>GRASS_LINE_WIDTH</dt>
- <dd>defines default line width.</dd>
-
- <dt>GRASS_TEXT_SIZE</dt>
- <dd>defines default text size.</dd>
- </dl>
- For specific driver-related variables see:
- <ul>
- <li><em><a href="cairodriver.html">Cairo driver</a></em></li>
- <li><em><a href="pngdriver.html">PNG driver</a></em></li>
- <li><em><a href="psdriver.html">PS (Postscript) driver</a></em></li>
- <li><em><a href="htmldriver.html">HTML driver</a></em></li>
- </ul>
- <a name="internal"></a>
- <h3>List of selected internal GRASS environment variables</h3>
- <blockquote>
- [ These variables are intended <b>for internal use only</b> by the GRASS
- software to facilitate communication between the GIS engine, GRASS scripts,
- and the GUI.
-
- The user should not set these in a GRASS session. They are meant to be set
- locally for specific commands. ]
- </blockquote>
- <dl>
- <dt>GRASS_OVERWRITE</dt>
- <dd>[all modules]<br>
- toggles map overwrite.
- <ul>
- <li>0 - maps are protected (default),</li>
- <li>1 - maps with identical names will be overwritten.</li>
- </ul>
- This variable is automatically created
- by <em><a href="g.parser.html">g.parser</a></em> so that the
- <tt>--overwrite</tt> option will
- be inherited by dependent modules as the script runs. Setting either the
- GRASS_OVERWRITE environment variable or the OVERWRITE gisenv variable detailed
- below will cause maps with identical names to be overwritten.</dd>
-
- <dt>GRASS_VERBOSE</dt>
- <dd>[all modules]<br>
- toggles verbosity level
- <ul>
- <li>-1 - complete silence (also errors and warnings are discarded)</li>
- <li>0 - only errors and warnings are printed</li>
- <li>1 - progress and important messages are printed (percent complete)</li>
- <li>2 - all module messages are printed</li>
- <li>3 - additional verbose messages are printed</li>
- </ul>
- This variable is automatically created by <em><a href="g.parser.html">g.parser</a></em>
- so that the <tt>--verbose</tt> or <tt>--quiet</tt> flags will be inherited
- by dependent modules as the script runs.</dd>
-
- <dt>GRASS_REGION</dt>
- <dd>[libgis]<br>
- override region settings, separate parameters with a ";". Format
- is the same as in the WIND region settings file. Otherwise use is the same as
- WIND_OVERRIDE.</dd>
-
- <dt>WIND_OVERRIDE</dt>
- <dd>[libgis]<br>
- it causes programs to use the specified named region (created with
- e.g. <tt>g.region save=...</tt>) to be used as the current region, instead of
- the region from the WIND file.<br><br>
- This allows programs such as the GUI to run external commands on an
- alternate region without having to modify the WIND file then change it
- back afterwards.</dd>
- </dl>
- <a name="gisenv"></a>
- <h2>List of selected GRASS gisenv variables</h2>
- <blockquote>
- [ Use <em><a href="g.gisenv.html">g.gisenv</a></em> to get/set/unset/change them ]
- </blockquote>
- <dl>
-
- <dt>DEBUG</dt>
- <dd>[entire GRASS]<br>
- sets level of debug message output (0: no debug messages)
- <div class="code"><pre>
- g.gisenv set=DEBUG=0
- </pre></div>
- <dt>WX_DEBUG</dt>
- <dd>[wxGUI]<br>
- sets level of debug message output for <em><a href="wxGUI.html">wxGUI</a></em> (0: no debug messages, 1-5 debug levels)
-
- <dt>GISDBASE</dt>
- <dd>initial database</dd>
- <dt>GIS_LOCK</dt>
- <dd>lock ID to prevent parallel GRASS use,
- <br>process id of the start-up shell script</dd>
-
- <dt>GRASS_DB_ENCODING</dt>
- <dd>[d.what.vect/forms library]<br>
- encoding of query form (utf-8, ascii, iso8859-1, koi8-r)</dd>
-
- <dt>GUI</dt>
- <dd>See <tt>GRASS_GUI</tt> environmental variable for details.</dd>
-
- <dt>LOCATION</dt>
- <dd>full path to location directory</dd>
-
- <dt>LOCATION_NAME</dt>
- <dd>initial location name</dd>
-
- <dt>MAPSET</dt>
- <dd>initial mapset</dd>
-
- <dt>OVERWRITE</dt>
- <dd>[all modules]<br>
- toggles map overwrite.
- <ul>
- <li>0 - maps are protected (default),</li>
- <li>1 - maps with identical names will be overwritten.</li>
- </ul>
- This variable is automatically created
- by <em><a href="g.parser.html">g.parser</a></em> so that the
- <tt>--overwrite</tt> option will
- be inherited by dependent modules as the script runs. Setting either the
- GRASS_OVERWRITE environment variable or the OVERWRITE gisenv variable detailed
- below will cause maps with identical names to be overwritten.</dd>
- </dl>
- <h2>GRASS-related Files</h2>
- <dl>
- <dt><tt>$HOME/.grass7/rc</tt></dt>
- <dd>stores the GRASS gisenv variables (not shell environment variables)</dd>
- <dt><tt>$HOME/.grass7/bashrc</tt></dt>
- <dd>stores the shell environment variables (Bash only)</dd>
- <dt><tt>$HOME/.grass7/env.bat</tt></dt>
- <dd>stores the shell environment variables (MS Windows only)</dd>
-
- <dt><tt>$HOME/.grass7/login</tt></dt>
- <dd>stores the DBMI passwords in this hidden file.
- Only the file owner can access this file.</dd>
- <dt><tt>$HOME/GIS_ERROR_LOG</tt></dt>
- <dd>if this file exists then all GRASS error and warning messages are
- logged here. Applies to current user. To generate the file, use:
- <tt>touch $HOME/GIS_ERROR_LOG</tt><br>
- See also GIS_ERROR_LOG variable.</dd>
- </dl>
- <h2>SEE ALSO</h2>
- <em>
- <a href="g.gisenv.html">g.gisenv</a>,
- <a href="g.parser.html">g.parser</a>
- </em>
- <p>
- <i>Last changed: $Date$</i>
|