grass7(1)

GRASS startup program

SYNOPSIS
grass70 [-h | -help | --help] [-v | --version] [-c | -c geofile | -c EPSG:code[:datum_trans]] [-text | -gtext | -gui] [[[<GISDBASE>/]<LOCATION_NAME>/] <MAPSET>]

  Flags:

-h | -help | --help
    Prints a brief usage message and exits

-v | --verbose
    Prints the version of GRASS and exits

-c
    Creates new GRASS unprojected location in specified GISDBASE

-c geofile
    Creates new GRASS projected location in specified GISDBASE based on georeferenced file

-c EPSG:code
    Creates new GRASS projected location in specified GISDBASE with given EPSG code

-c EPSG:code:datum_trans
    Creates new GRASS projected location in specified GISDBASE with given EPSG code and datum transform parameters

-text
    Indicates that Text-based User Interface should be used (skip welcome screen)

-gtext
    Indicates that Text-based User Interface should be used (show welcome screen)

-gui
    Indicates that Graphical User Interface (wxGUI) should be used

  Parameters:

GISDBASE
    Initial database directory which should be a fully qualified path (e.g., /usr/local/share/grassdata)

LOCATION_NAME
    Initial location directory which is a subdirectory of GISDBASE

MAPSET
    Initial mapset directory which is a subdirectory of LOCATION_NAME Note: These parameters must be specified in one of the following ways:

        MAPSET
        LOCATION_NAME/MAPSET
        GISDBASE/LOCATION_NAME/MAPSET

DESCRIPTION

This command is used to launch GRASS GIS. It will parse the command line arguments and then initialize GRASS for the user. Since GRASS modules require a specific environment, this program must be called before any other GRASS module can run. The command line arguments are optional and provide the user with a method to indicate the desired user interface, as well as the desired mapset to work on.

The startup program will remember both the desired user interface and mapset. Thus, the next time the user runs GRASS, typing grass70 (without any options) will start GRASS with the previous settings for the user interface and mapset selected.

If you specify a graphical user interface (-gui) the grass70 program will try to verify that the system you specified exists and that you can access it successfully. If any of these checks fail then grass70 will automatically switch back to the text user interface mode.

ENVIRONMENT VARIABLES
A number of environment variables are available at GRASS startup to assist with automation and customization. Most users will not need to bother with these.

In addition to these shell environment variables GRASS maintains a number of GIS environment variables in the $HOME/.grass7/rc file. User changes to this file will be read during the next startup of GRASS. If this file becomes corrupted the user may edit it by hand or remove it to start afresh. See the list of implemented GRASS variables for more information. The rest of this help page will only consider shell environment variables.

Note that you will need to set these variables using the appropriate method required for the UNIX shell that you use (e.g. in a Bash shell you must export the variables for them to propogate).

  User Interface Environment Variable

The grass70 program will check for the existence of an environment variable called GRASS_GUI which indicates the type of user interface for GRASS to use. If this variable is not set when grass70 is run, then it will be created and then saved in the $HOME/.grass7/rc file for the next time GRASS is run. It can be set to text, gtext or gui.

There is an order of precedence in the way grass70 determines the user interface to use. The following is the hierarchy from highest precedence to lowest.

1   Command line argument

2   Environment variable GRASS_GUI

3   Value set in $HOME/.grass7/rc (GUI)

4   Default value - gui

  Python Environment Variables

If you choose to use wxGUI interface, then the GRASS_PYTHON environment variable can be used to override your system default python command.

Suppose for example your system has Python 2.5 installed and you install a personal version of the Python 2.6 binaries under $HOME/bin. You can use the above variables to have GRASS use the Python 2.6 binaries instead.

   GRASS_PYTHON=python2.6

  Addon Path to Extra User Scripts
This environment variable allows the user to extend the GRASS program search paths to include locally developed/installed GRASS modules or user scripts.

   GRASS_ADDON_PATH=/usr/mytools
   GRASS_ADDON_PATH=/usr/mytools:/usr/local/othertools

In this example above path(s) would be added to the standard GRASS path environment.

  Addon Base for Extra Local GRASS Addon Modules
This environment variable allows the user to extend the GRASS program search paths to include locally installed (see g.extension for details) GRASS Addon modules which are not distributed with the standard GRASS release.

   GRASS_ADDON_BASE=/usr/grass-addons

In this example above path would be added to the standard GRASS path environment.

If not defined by user, this variable is set by GRASS startup program to $HOME/.grass7/addons on GNU/Linux and $APPDATA\GRASS7\addons on MS Windows.

  HTML Browser Variable
The GRASS_HTML_BROWSER environment variable allows the user to set the HTML web browser to use for displaying help pages.

  Location Environment Variables

The Synopsis section above describes options that can be used to set the location and mapset that GRASS will use. These values can also be set with environment variables. However, specifying the location and mapset variables on the command line will override these environment variables. The available variables are as follows:

LOCATION
    A fully qualified path to a mapset (eg /usr/local/share/grassdata/spearfish60/PERMANENT). This environment variable overrides the GISDBASE, LOCATION_NAME, and MAPSET variables.

GISDBASE
    Initial database directory which should be a fully qualified path (eg /usr/local/share/grassdata)

LOCATION_NAME
    Initial location directory which is a subdirectory of GISDBASE

MAPSET
    Initial mapset directory which is a subdirectory of LOCATION_NAME

  Running non-interactive batch jobs
If the GRASS_BATCH_JOB environment variable is set to the full path and filename of a shell script then GRASS will be launched in a non-interactive way and the script will be run. The script itself can be interactive if that is what the user requires. When it is finished GRASS will automatically exit using the exit-success code given by the script. The script file must have its executable bit set.

EXAMPLES

The following are some examples of how you could start GRASS

grass70
    Start GRASS using the default user interface. The user will be prompted to choose the appropriate location and mapset.

grass70 -gui
    Start GRASS using the graphical user interface. The user will be prompted to choose the appropriate location and mapset.

grass70 -text
    Start GRASS using the text-based user interface. Appropriate location and mapset must be set by environmental variables (see examples bellow) otherwise taken from the last GRASS session.

grass70 -gtext
    Start GRASS using the text-based user interface. The user will be prompted to choose the appropriate location and mapset.

grass70 $HOME/grassdata/spearfish60/user1
    Start GRASS using the default user interface and automatically launch into the given mapset, bypassing the mapset selection menu.

grass70 -gui -
    Start GRASS using the graphical user interface and try to obtain the location and mapset from environment variables.

grass70 -c EPSG:4326 $HOME/grassdata/mylocation
    Creates new GRASS location with EPSG code 4326 (latitude-longitude, WGS84) in the specified GISDBASE

grass70 -c EPSG:5514:3 $HOME/grassdata/mylocation
    Creates new GRASS location with EPSG code 5514 (S-JTSK / Krovak East North - SJTSK) with datum transformation parameters used in Czech Republic in the specified GISDBASE

grass70 -c myvector.shp $HOME/grassdata/mylocation
    Creates new GRASS location based on georeferenced Shapefile

grass70 -c myraster.tif $HOME/grassdata/mylocation
    Creates new GRASS location based on georeferenced GeoTIFF file

  Other examples
There are a variety of ways in which the location environment variables (see above) can be used to specify the mapset to use. The following are some possible examples.

  Example 1
The environment variables are defined as follows:

LOCATION = /usr/local/share/grassdata/spearfish60/PERMANENT
GISDBASE = /usr/local/share/grassdata
LOCATION_NAME = spearfish60
MAPSET = PERMANENT

Start GRASS with the following command:

grass70 -

GRASS will start with the mapset defined by LOCATION since the LOCATION variable overrides the other variables.

  Example 2
The environment variables are defined as follows:

GISDBASE = /usr/local/share/grassdata
LOCATION_NAME = spearfish60
MAPSET = PERMANENT

Start GRASS with the following command:

grass70 -

GRASS will start with the mapset defined by GISDBASE/LOCATION_NAME/MAPSET.

grass70 /usr/home/grass/data/thailand/forests

GRASS will start with the mapset /home/grass/data/thailand/forests which overrides the environment variables.

grass70 swamps

GRASS will start with the mapset defined by GISDBASE/LOCATION_NAME/swamps since the command line argument for the mapset overrides the environment variable MAPSET.

grass70 thailand/forests

GRASS will start with the mapset defined by GISDBASE/thailand/forests since the command line arguments for the location and mapset overrides the environment variables LOCATION_NAME and MAPSET.

CAVEAT
If you start GRASS using the wxGUI interface you must have a python command in your $PATH variable. That is, the command must be named python and not something like python2.6. Rarely some Python installations do not create a python command. In these cases you can override python by GRASS_PYTHON environmental variable.

Furthermore, if you have more than one version of Python installed, make sure that the version you want to use with GRASS is set by GRASS_PYTHON environmental variable.

SEE ALSO
List of GRASS environment variables

GRASS GIS Web site
GRASS GIS User Wiki
GRASS GIS Bug Tracker
GRASS GIS 7 Programmer’s Manual

AUTHORS (of this page)
Justin Hickey
Markus Neteler
Hamish Bowman
Martin Landa, Czech Technical University in Prague, Czech Republic

Last changed: $Date: 2015-01-25 18:56:33 +0100 (ne, 25 1 2015) $

Main index | Topics index | Keywords index | Full index

© 2003-2015 GRASS Development Team, GRASS GIS 7.0.1 Reference Manual