.TH grass7 1 "" "GRASS 7.6.1" "Grass User's Manual" .SH GRASS startup program .SH SYNOPSIS \fBgrass76\fR [\fB\-h\fR | \fB\-help\fR | \fB\-\-help\fR] [\fB\-v\fR | \fB\-\-version\fR] [\fB\-c\fR | \fB\-c geofile\fR | \fB\-c EPSG:code[:datum_trans]\fR] [\fB\-\-text\fR | \fB\-\-gtext\fR | \fB\-\-gui\fR] [[[\fB/\fR]\fB/\fR] \fB\fR] .SS Flags: .IP "\fB\-h\fR | \fB\-help\fR | \fB\-\-help\fR " 4m .br Prints a brief usage message and exits .IP "\fB\-v\fR | \fB\-\-verbose\fR " 4m .br Prints the version of GRASS and exits .IP "\fB\-c\fR " 4m .br Creates new GRASS unprojected location in specified GISDBASE .IP "\fB\-c geofile\fR " 4m .br Creates new GRASS projected location in specified GISDBASE based on georeferenced file .IP "\fB\-c EPSG:code\fR " 4m .br Creates new GRASS projected location in specified GISDBASE with given EPSG code .IP "\fB\-c EPSG:code:datum_trans\fR " 4m .br Creates new GRASS projected location in specified GISDBASE with given EPSG code and datum transform parameters .IP "\fB\-e\fR " 4m .br Exit after creation of location or mapset. Only with \fB\-c\fR flag .IP "\fB\-f\fR " 4m .br Forces removal of .gislock if exists (use with care!). Only with \-\-text flag .IP "\fB\-\-text\fR " 4m .br Indicates that Text\-based User Interface should be used (skip welcome screen) .IP "\fB\-\-gtext\fR " 4m .br Indicates that Text\-based User Interface should be used (show welcome screen) .IP "\fB\-\-gui\fR " 4m .br Indicates that Graphical User Interface (\fIwxGUI\fR) should be used .IP "\fB\-\-config\fR " 4m .br Prints GRASS configuration parameters (options: arch, build, compiler, path, revision) .IP "\fB\-\-exec EXECUTABLE\fR " 4m .br Execute GRASS module or script. The provided executable will be executed in a GRASS GIS non\-interactive session. .IP "\fB\-\-tmp\-location\fR " 4m .br Run using a temporary location which is created based on the given coordinate reference system and deleted at the end of the execution (use the \-\-exec flag). The active mapset will be PERMANENT. .SS Parameters: .IP "\fBGISDBASE\fR " 4m .br Initial database directory which should be a fully qualified path (e.g., /usr/local/share/grassdata) .IP "\fBLOCATION\fR " 4m .br Initial location directory which is a subdirectory of GISDBASE .IP "\fBMAPSET\fR " 4m .br Initial mapset directory which is a subdirectory of LOCATION \fINote\fR: These parameters must be specified in one of the following ways: .br .nf \fC MAPSET LOCATION/MAPSET GISDBASE/LOCATION/MAPSET \fR .fi .SH DESCRIPTION .PP 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. .PP The startup program will remember both the desired user interface and mapset. Thus, the next time the user runs GRASS, typing \fIgrass76\fR (without any options) will start GRASS with the previous settings for the user interface and mapset selected. .PP If you specify a graphical user interface (\fB\-\-gui\fR) the \fIgrass76\fR 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 \fIgrass76\fR will automatically switch back to the text user interface mode. .SH SAMPLE DATA The GRASS GIS project provides several free sample geospatial datasets as ready\-to\-use locations. They are available to download at https://grass.osgeo.org/download/sample\-data/. The \(dqNorth Carolina data set\(dq is a modern package of geospatial data from North Carolina (USA), and it includes raster, vector, LiDAR and satellite data. This is the most extensively used data set in the documentation and the examples throughout the user manual pages are based upon it. .SH 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. .PP 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 \fIimplemented GRASS variables\fR for more information. The rest of this help page will only consider shell environment variables. .PP 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 propagate). .SS User Interface Environment Variable .PP The \fIgrass76\fR 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 \fIgrass76\fR 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. .PP There is an order of precedence in the way \fIgrass76\fR determines the user interface to use. The following is the hierarchy from highest precedence to lowest. .IP .IP \fB1\fR Command line argument .IP \fB2\fR Environment variable GRASS_GUI .IP \fB3\fR Value set in $HOME/.grass7/rc (GUI) .IP \fB4\fR Default value \- gui .PP .SS Python Environment Variables .PP If you choose to use \fIwxGUI\fR interface, then the GRASS_PYTHON environment variable can be used to override your system default python command. .PP Suppose for example your system has Python 2.6 installed and you install a personal version of the Python 2.7 binaries under $HOME/bin. You can use the above variables to have GRASS use the Python 2.7 binaries instead. .br .nf \fC GRASS_PYTHON=python2.7 \fR .fi .SS 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. .br .nf \fC GRASS_ADDON_PATH=/usr/mytools GRASS_ADDON_PATH=/usr/mytools:/usr/local/othertools \fR .fi .PP In this example above path(s) would be added to the standard GRASS path environment. .SS 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 \fIg.extension\fR for details) GRASS Addon modules which are not distributed with the standard GRASS release. .br .nf \fC GRASS_ADDON_BASE=/usr/grass\-addons \fR .fi .PP In this example above path would be added to the standard GRASS path environment. .PP If not defined by user, this variable is set by GRASS startup program to $HOME/.grass7/addons on GNU/Linux and $APPDATA\(rsGRASS7\(rsaddons on MS Windows. .SS HTML Browser Variable The GRASS_HTML_BROWSER environment variable allows the user to set the HTML web browser to use for displaying help pages. .SS Location Environment Variables .PP The \fBSynopsis\fR 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: .IP "LOCATION " 4m .br A fully qualified path to a mapset (eg /usr/local/share/grassdata/spearfish70/PERMANENT). This environment variable overrides the GISDBASE, LOCATION_NAME, and MAPSET variables. .IP "GISDBASE " 4m .br Initial database directory which should be a fully qualified path (eg /usr/local/share/grassdata) .IP "LOCATION_NAME " 4m .br Initial location directory which is a subdirectory of GISDBASE .IP "MAPSET " 4m .br Initial mapset directory which is a subdirectory of LOCATION_NAME .SS Running non\-interactive batch jobs If the GRASS_BATCH_JOB environment variable is set to the \fIfull\fR 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. .SH EXAMPLES .PP The following are some examples of how you could start GRASS .IP "\fBgrass76\fR " 4m .br Start GRASS using the default user interface. The user will be prompted to choose the appropriate location and mapset. .IP "\fBgrass76 \-\-gui\fR " 4m .br Start GRASS using the graphical user interface. The user will be prompted to choose the appropriate location and mapset. .IP "\fBgrass76 \-\-text\fR " 4m .br Start GRASS using the text\-based user interface. Appropriate location and mapset must be set by environmental variables (see examples below) otherwise taken from the last GRASS session. .IP "\fBgrass76 \-\-gtext\fR " 4m .br Start GRASS using the text\-based user interface. The user will be prompted to choose the appropriate location and mapset. .IP "\fBgrass76 $HOME/grassdata/spearfish70/user1\fR " 4m .br Start GRASS using the default user interface and automatically launch into the given mapset, bypassing the mapset selection menu. .IP "\fBgrass76 \-\-gui \-\fR " 4m .br Start GRASS using the graphical user interface and try to obtain the location and mapset from environment variables. .IP "\fBgrass76 \-c EPSG:4326 $HOME/grassdata/mylocation\fR " 4m .br Creates a new GRASS location with EPSG code 4326 (latitude\-longitude, WGS84) in the specified GISDBASE .IP "\fBgrass76 \-c EPSG:5514:3 $HOME/grassdata/mylocation\fR " 4m .br Creates a 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 .IP "\fBgrass76 \-c XY $HOME/grassdata/gnomonic \-\-exec g.proj \-c proj4=\(cq+proj=gnom +lat_0=90 +lon_0=\-50\(cq\fR " 4m .br Creates a new GRASS location from PROJ definition string (here: gnomonic) in the specified GISDBASE .IP "\fBgrass76 \-c myvector.shp $HOME/grassdata/mylocation\fR " 4m .br Creates a new GRASS location based on georeferenced Shapefile .IP "\fBgrass76 \-c myraster.tif $HOME/grassdata/mylocation\fR " 4m .br Creates a new GRASS location based on georeferenced GeoTIFF file .SS Batch jobs with the exec interface Creating a new Location based on a geodata file\(cqs projection (\fB\-c\fR) and exit (\fB\-e\fR) immediately: .br .nf \fC grass76 \-c elevation.tiff \-e /path/to/grassdata/test1/ \fR .fi Linking external raster data to PERMANENT Mapset: .br .nf \fC grass76 /path/to/grassdata/test1/PERMANENT/ \-\-exec r.external input=basins.tiff output=basins grass76 /path/to/grassdata/test1/PERMANENT/ \-\-exec r.external input=elevation.tiff output=elevation \fR .fi Get statistics for one raster map: .br .nf \fC grass76 /path/to/grassdata/test1/PERMANENT/ \-\-exec r.univar map=elevation \fR .fi Compare the rasters visually: .br .nf \fC grass76 /path/to/grassdata/test1/PERMANENT/ \-\-exec g.gui.mapswipe first=elevation second=basins \fR .fi .SS Execution of shell and Python scripts instead of single commands A sequence of commands can be bundled in a script and executed using the exec interface. .PP \fBShell script example:\fR the command to execute a shell script might be: .br .nf \fC grass76 /path/to/grassdata/test1/PERMANENT/ \-\-exec sh test.sh \fR .fi A very simple bash script (\(dqtest.sh\(dq) may look like this: .br .nf \fC #!/bin/bash g.region \-p g.list type=raster r.info elevation \fR .fi .PP \fBPython script example:\fR the command to execute a Python script might be: .br .nf \fC grass76 /path/to/grassdata/test1/PERMANENT/ \-\-exec python test.py \fR .fi A very simple Python script (\(dqtest.py\(dq) may look like this: .br .nf \fC #!/usr/bin/env python # import GRASS Python bindings (see also pygrass) import grass.script as gscript import grass.script.setup as gsetup gscript.message(\(cqCurrent GRASS GIS 7 environment:\(cq) print(gscript.gisenv()) gscript.message(\(cqAvailable raster maps:\(cq) for raster in gscript.list_strings(type=\(cqraster\(cq): print(raster) gscript.message(\(cqAvailable vector maps:\(cq) for vector in gscript.list_strings(type=\(cqvector\(cq): print(vector) \fR .fi .SS Using temporary location Creating a new temporary location based on a georeferenced file\(cqs projection coordinate reference system (CRS) and simultaneously starting computation in a shell script: .br .nf \fC grass76 \-\-tmp\-location elevation.tiff \-\-exec test.sh \fR .fi The same, but using an EPSG code and a Python script: .br .nf \fC grass76 \-\-tmp\-location EPSG:3358 \-\-exec test.py \fR .fi Finally, for special cases, we can create an XY location without any CRS: .br .nf \fC grass76 \-\-tmp\-location XY \-\-exec test.py \fR .fi Temporary location is automatically deleted after computation, so the script is expected to export, link or otherwise preserve the output data before ending. .PP A single command can be also executed, e.g. to examine properties of the temporary location: .br .nf \fC grass76 \-\-tmp\-location EPSG:3358 \-\-exec g.proj \-p \fR .fi A temporary XY location with single command is useful, e.g. to show help text of a module: .br .nf \fC grass76 \-\-tmp\-location XY \-\-exec r.neighbors \-\-help \fR .fi .SS Troubleshooting Importantly, to avoid an \(dq[Errno 8] Exec format error\(dq there must be a shebang line at the top of the script (like #!/bin/sh, #!/bin/bash, or #!/usr/bin/env python) indicating which interpreter to be used for the script. The script file must have its executable bit set. .SH CAVEAT If you start GRASS using the \fIwxGUI\fR 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. .PP 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. .SH SEE ALSO List of GRASS environment variables .PP GRASS GIS Web site .br GRASS GIS User Wiki .br GRASS GIS Bug Tracker .br GRASS GIS 7 Programmer\(cqs Manual .SH AUTHORS (of this page) Justin Hickey .br Markus Neteler .br Hamish Bowman .br Martin Landa, Czech Technical University in Prague, Czech Republic .PP \fILast changed: $Date: 2018\-11\-30 12:44:28 +0100 (Fri, 30 Nov 2018) $\fR .PP Main index | Topics index | Keywords index | Graphical index | Full index .PP © 2003\-2019 GRASS Development Team, GRASS GIS 7.6.1 Reference Manual