1grass7(1)                     Grass User's Manual                    grass7(1)
2
3
4

GRASS startup program

SYNOPSIS

7       grass74  [-h  |  -help | --help] [-v | --version] [-c | -c geofile | -c
8       EPSG:code[:datum_trans]] [-text | -gtext | -gui]  [[[<GISDBASE>/]<LOCA‐
9       TION_NAME>/] <MAPSET>]
10
11   Flags:
12       -h | -help | --help
13           Prints a brief usage message and exits
14
15       -v | --verbose
16           Prints the version of GRASS and exits
17
18       -c
19           Creates new GRASS unprojected location in specified GISDBASE
20
21       -c geofile
22           Creates new GRASS projected location in specified GISDBASE based on
23           georeferenced file
24
25       -c EPSG:code
26           Creates new GRASS projected location  in  specified  GISDBASE  with
27           given EPSG code
28
29       -c EPSG:code:datum_trans
30           Creates  new  GRASS  projected  location in specified GISDBASE with
31           given EPSG code and datum transform parameters
32
33       -e
34           Exit after creation of location or mapset. Only with -c flag
35
36       -f
37           Forces removal of .gislock if exists (use with  care!).  Only  with
38           -text flag
39
40       -text
41           Indicates  that Text-based User Interface should be used (skip wel‐
42           come screen)
43
44       -gtext
45           Indicates that Text-based User Interface should be used (show  wel‐
46           come screen)
47
48       -gui
49           Indicates that Graphical User Interface (wxGUI) should be used
50
51       --config
52           Prints  GRASS  configuration parameters (options: arch, build, com‐
53           piler, path, revision)
54
55       --exec EXECUTABLE
56           Execute GRASS module or script. The  provided  executable  will  be
57           executed in a GRASS GIS non-interactive session.
58
59   Parameters:
60       GISDBASE
61           Initial  database  directory which should be a fully qualified path
62           (e.g., /usr/local/share/grassdata)
63
64       LOCATION_NAME
65           Initial location directory which is a subdirectory of GISDBASE
66
67       MAPSET
68           Initial mapset directory which is a subdirectory  of  LOCATION_NAME
69           Note:  These  parameters  must be specified in one of the following
70           ways:
71               MAPSET
72               LOCATION_NAME/MAPSET
73               GISDBASE/LOCATION_NAME/MAPSET
74

DESCRIPTION

76       This command is used to launch GRASS GIS. It  will  parse  the  command
77       line arguments and then initialize GRASS for the user. Since GRASS mod‐
78       ules require a specific environment, this program must be called before
79       any other GRASS module can run. The command line arguments are optional
80       and provide the user with a method to indicate the desired user  inter‐
81       face, as well as the desired mapset to work on.
82
83       The  startup  program will remember both the desired user interface and
84       mapset. Thus, the next time the user runs GRASS, typing grass74  (with‐
85       out  any  options)  will start GRASS with the previous settings for the
86       user interface and mapset selected.
87
88       If you specify a graphical user interface (-gui)  the  grass74  program
89       will  try  to  verify that the system you specified exists and that you
90       can access it successfully. If any of these checks  fail  then  grass74
91       will automatically switch back to the text user interface mode.
92

SAMPLE DATA

94       The  GRASS GIS project provides several free sample geospatial datasets
95       as  ready-to-use  locations.  They  are  available   to   download   at
96       https://grass.osgeo.org/download/sample-data/.    The  "North  Carolina
97       data set" is a modern package of geospatial data  from  North  Carolina
98       (USA),  and  it includes raster, vector, LiDAR and satellite data. This
99       is the most extensively used data set  in  the  documentation  and  the
100       examples throughout the user manual pages are based upon it.
101

ENVIRONMENT VARIABLES

103       A  number  of  environment  variables are available at GRASS startup to
104       assist with automation and customization. Most users will not  need  to
105       bother with these.
106
107       In addition to these shell environment variables GRASS maintains a num‐
108       ber of GIS environment variables in  the  $HOME/.grass7/rc  file.  User
109       changes  to this file will be read during the next startup of GRASS. If
110       this file becomes corrupted the user may edit it by hand or  remove  it
111       to  start afresh.  See the list of implemented GRASS variables for more
112       information.  The rest of this help page will only consider shell envi‐
113       ronment variables.
114
115       Note  that  you  will need to set these variables using the appropriate
116       method required for the UNIX shell that you use (e.g. in a  Bash  shell
117       you must export the variables for them to propagate).
118
119   User Interface Environment Variable
120       The  grass74  program  will  check  for the existence of an environment
121       variable called GRASS_GUI which indicates the type  of  user  interface
122       for GRASS to use. If this variable is not set when grass74 is run, then
123       it will be created and then saved in the $HOME/.grass7/rc file for  the
124       next time GRASS is run. It can be set to text, gtext or gui.
125
126       There  is an order of precedence in the way grass74 determines the user
127       interface to use. The following is the hierarchy  from  highest  prece‐
128       dence to lowest.
129
130       1      Command line argument
131
132       2      Environment variable GRASS_GUI
133
134       3      Value set in $HOME/.grass7/rc (GUI)
135
136       4      Default value - gui
137
138   Python Environment Variables
139       If you choose to use wxGUI interface, then the GRASS_PYTHON environment
140       variable can be used to override your system default python command.
141
142       Suppose for example your  system  has  Python  2.6  installed  and  you
143       install  a personal version of the Python 2.7 binaries under $HOME/bin.
144       You can use the above variables to have GRASS use the Python 2.7  bina‐
145       ries instead.
146          GRASS_PYTHON=python2.7
147
148   Addon Path to Extra User Scripts
149       This  environment  variable allows the user to extend the GRASS program
150       search paths to include locally developed/installed  GRASS  modules  or
151       user scripts.
152          GRASS_ADDON_PATH=/usr/mytools
153          GRASS_ADDON_PATH=/usr/mytools:/usr/local/othertools
154
155       In this example above path(s) would be added to the standard GRASS path
156       environment.
157
158   Addon Base for Extra Local GRASS Addon Modules
159       This environment variable allows the user to extend the  GRASS  program
160       search paths to include locally installed (see g.extension for details)
161       GRASS Addon modules which are not distributed with the  standard  GRASS
162       release.
163          GRASS_ADDON_BASE=/usr/grass-addons
164
165       In  this  example  above path would be added to the standard GRASS path
166       environment.
167
168       If not defined by user, this variable is set by GRASS  startup  program
169       to  $HOME/.grass7/addons  on GNU/Linux and $APPDATA\GRASS7\addons on MS
170       Windows.
171
172   HTML Browser Variable
173       The GRASS_HTML_BROWSER environment variable allows the user to set  the
174       HTML web browser to use for displaying help pages.
175
176   Location Environment Variables
177       The  Synopsis  section  above describes options that can be used to set
178       the location and mapset that GRASS will use. These values can  also  be
179       set  with  environment  variables. However, specifying the location and
180       mapset variables on the command line will  override  these  environment
181       variables. The available variables are as follows:
182
183       LOCATION
184           A  fully  qualified  path  to  a mapset (eg /usr/local/share/grass‐
185           data/spearfish70/PERMANENT). This  environment  variable  overrides
186           the GISDBASE, LOCATION_NAME, and MAPSET variables.
187
188       GISDBASE
189           Initial  database  directory which should be a fully qualified path
190           (eg /usr/local/share/grassdata)
191
192       LOCATION_NAME
193           Initial location directory which is a subdirectory of GISDBASE
194
195       MAPSET
196           Initial mapset directory which is a subdirectory of LOCATION_NAME
197
198   Running non-interactive batch jobs
199       If the GRASS_BATCH_JOB environment variable is set to the full path and
200       filename  of a shell script then GRASS will be launched in a non-inter‐
201       active way and the script will be run. The script itself can be  inter‐
202       active  if  that  is  what the user requires. When it is finished GRASS
203       will automatically exit  using  the  exit-success  code  given  by  the
204       script. The script file must have its executable bit set.
205

EXAMPLES

207       The following are some examples of how you could start GRASS
208
209       grass74
210           Start  GRASS  using  the  default  user interface. The user will be
211           prompted to choose the appropriate location and mapset.
212
213       grass74 -gui
214           Start GRASS using the graphical user interface. The  user  will  be
215           prompted to choose the appropriate location and mapset.
216
217       grass74 -text
218           Start  GRASS using the text-based user interface. Appropriate loca‐
219           tion and mapset must be set by environmental variables  (see  exam‐
220           ples below) otherwise taken from the last GRASS session.
221
222       grass74 -gtext
223           Start  GRASS  using the text-based user interface. The user will be
224           prompted to choose the appropriate location and mapset.
225
226       grass74 $HOME/grassdata/spearfish70/user1
227           Start GRASS using the  default  user  interface  and  automatically
228           launch into the given mapset, bypassing the mapset selection menu.
229
230       grass74 -gui -
231           Start  GRASS  using  the graphical user interface and try to obtain
232           the location and mapset from environment variables.
233
234       grass74 -c EPSG:4326 $HOME/grassdata/mylocation
235           Creates new GRASS location with EPSG code 4326 (latitude-longitude,
236           WGS84) in the specified GISDBASE
237
238       grass74 -c EPSG:5514:3 $HOME/grassdata/mylocation
239           Creates  new  GRASS  location  with EPSG code 5514 (S-JTSK / Krovak
240           East North - SJTSK) with datum transformation  parameters  used  in
241           Czech Republic in the specified GISDBASE
242
243       grass74 -c myvector.shp $HOME/grassdata/mylocation
244           Creates new GRASS location based on georeferenced Shapefile
245
246       grass74 -c myraster.tif $HOME/grassdata/mylocation
247           Creates new GRASS location based on georeferenced GeoTIFF file
248
249   Batch jobs with the exec interface
250       Creating  a  new Location based on a geodata file’s projection (-c) and
251       exit (-e) immediately:
252       grass74 -c elevation.tiff -e /path/to/grassdata/test1/
253       Linking external raster data to PERMANENT Mapset:
254       grass74 /path/to/grassdata/test1/PERMANENT/ --exec r.external input=basins.tiff output=basins
255       grass74 /path/to/grassdata/test1/PERMANENT/ --exec r.external input=elevation.tiff output=elevation
256       Get statistics for one raster map:
257       grass74 /path/to/grassdata/test1/PERMANENT/ --exec r.univar map=elevation
258       Compare the rasters visually:
259       grass74 /path/to/grassdata/test1/PERMANENT/ --exec g.gui.mapswipe first=elevation second=basins
260
261   Execution of shell and Python scripts instead of single commands
262       A sequence of commands can be bundled in a script  and  executed  using
263       the exec interface.
264
265       Shell script example: the command to execute a shell script might be:
266       grass74 /path/to/grassdata/test1/PERMANENT/ --exec sh test.sh
267       A very simple bash script ("test.sh") may look like this:
268       #!/bin/bash
269       g.region -p
270       g.list type=raster
271       r.info elevation
272
273       Python script example: the command to execute a Python script might be:
274       grass74 /path/to/grassdata/test1/PERMANENT/ --exec python test.py
275       A very simple Python script ("test.py") may look like this:
276       #!/usr/bin/python2
277       # import GRASS Python bindings (see also pygrass)
278       import grass.script as gscript
279       import grass.script.setup as gsetup
280       gscript.message(’Current GRASS GIS 7 environment:’)
281       print(gscript.gisenv())
282       gscript.message(’Available raster maps:’)
283       for raster in gscript.list_strings(type=’raster’):
284           print(raster)
285       gscript.message(’Available vector maps:’)
286       for vector in gscript.list_strings(type=’vector’):
287           print(vector)
288
289   Troubleshooting
290       Importantly,  to avoid an "[Errno 8] Exec format error" there must be a
291       shebang line at the top of the script (like #!/bin/sh, #!/bin/bash,  or
292       #!/usr/bin/python2)  indicating  which  interpreter  to be used for the
293       script. The script file must have its executable bit set.
294
295   Other examples
296       There are a variety of ways in which the location environment variables
297       (see  above)  can  be used to specify the mapset to use.  The following
298       are some possible examples.
299
300   Example 1
301       The environment variables are defined as follows:
302       LOCATION = /usr/local/share/grassdata/spearfish70/PERMANENT
303       GISDBASE = /usr/local/share/grassdata
304       LOCATION_NAME = spearfish70
305       MAPSET = PERMANENT
306       Start GRASS with the following command:
307       grass74 -
308       GRASS will start with the mapset defined by LOCATION since the LOCATION
309       variable overrides the other variables.
310
311   Example 2
312       The environment variables are defined as follows:
313       GISDBASE = /usr/local/share/grassdata
314       LOCATION_NAME = spearfish70
315       MAPSET = PERMANENT
316       Start GRASS with the following command:
317       grass74 -
318       GRASS   will   start   with   the   mapset  defined  by  GISDBASE/LOCA‐
319       TION_NAME/MAPSET.
320       grass74 /usr/home/grass/data/thailand/forests
321       GRASS will  start  with  the  mapset  /home/grass/data/thailand/forests
322       which overrides the environment variables.
323       grass74 swamps
324       GRASS   will   start   with   the   mapset  defined  by  GISDBASE/LOCA‐
325       TION_NAME/swamps since the command line argument for the  mapset  over‐
326       rides the environment variable MAPSET.
327       grass74 thailand/forests
328       GRASS  will  start with the mapset defined by GISDBASE/thailand/forests
329       since the command line arguments for the location and mapset  overrides
330       the environment variables LOCATION_NAME and MAPSET.
331

CAVEAT

333       If  you  start  GRASS  using the wxGUI interface you must have a python
334       command in your $PATH variable. That is,  the  command  must  be  named
335       python  and  not something like python2.6. Rarely some Python installa‐
336       tions do not create a python command. In these cases you  can  override
337       python by GRASS_PYTHON environmental variable.
338
339       Furthermore,  if  you  have  more than one version of Python installed,
340       make sure that the version you  want  to  use  with  GRASS  is  set  by
341       GRASS_PYTHON environmental variable.
342

SEE ALSO

344       List of GRASS environment variables
345
346       GRASS GIS Web site
347       GRASS GIS User Wiki
348       GRASS GIS Bug Tracker
349       GRASS GIS 7 Programmer’s Manual
350

AUTHORS (of this page)

352       Justin Hickey
353       Markus Neteler
354       Hamish Bowman
355       Martin Landa, Czech Technical University in Prague, Czech Republic
356
357       Last changed: $Date: 2017-11-12 20:37:57 +0100 (Sun, 12 Nov 2017) $
358
359       Main  index  |  Topics  index | Keywords index | Graphical index | Full
360       index
361
362       © 2003-2019 GRASS Development Team, GRASS GIS 7.4.4 Reference Manual
363
364
365
366GRASS 7.4.4                                                          grass7(1)
Impressum