1g.gisenv(1) GRASS GIS User's Manual g.gisenv(1)
2
3
4
6 g.gisenv - Outputs and modifies the user’s current GRASS variable set‐
7 tings.
8 Prints all defined GRASS variables if no option is given.
9
11 general, settings, variables, scripts
12
14 g.gisenv
15 g.gisenv --help
16 g.gisenv [-sn] [get=variable[,variable,...]] [set="variable=value"]
17 [unset=variable[,variable,...]] [store=string] [separator=charac‐
18 ter] [--help] [--verbose] [--quiet] [--ui]
19
20 Flags:
21 -s
22 Use shell syntax (for "eval")
23
24 -n
25 Do not use shell syntax
26
27 --help
28 Print usage summary
29
30 --verbose
31 Verbose module output
32
33 --quiet
34 Quiet module output
35
36 --ui
37 Force launching GUI dialog
38
39 Parameters:
40 get=variable[,variable,...]
41 GRASS variable to get
42
43 set="variable=value"
44 GRASS variable to set
45
46 unset=variable[,variable,...]
47 GRASS variable to unset
48
49 store=string
50 Where GRASS variable is stored
51 Options: gisrc, mapset
52 Default: gisrc
53
54 separator=character
55 Separator for multiple GRASS variables
56 Special characters: pipe, comma, space, tab, newline
57 Default: newline
58
60 When a user runs GRASS, certain variables are set specifying the GRASS
61 data base, location, mapset, peripheral device drivers, etc., being
62 used in the current GRASS session. These variable name settings are
63 recognized as long as the user is running a GRASS session.
64
66 No prompts are given to the user when running g.gisenv.
67
68 If run without arguments, g.gisenv lists all of the user’s current
69 GRASS variable settings. Results are sent to standard output, and may
70 look like this:
71 GISDBASE=/opt/grassdata/
72 LOCATION_NAME=nc_spm_08_grass7
73 MAPSET=/user1
74 GUI=gui
75
76 If the user specifies a get=variable_name on the command line
77 g.gisenv MAPSET
78 only the value for that particular GRASS variable is output to standard
79 output. Possible variable names depend on the user’s system, see vari‐
80 ables list for details. Note that the variable names are case-insensi‐
81 tive.
82
83 While other variables may be associated with each GRASS session (e.g.,
84 GRASS_GUI, GIS_LOCK, and other variables), those stated below are es‐
85 sential.
86
87 GISDBASE
88 The GISDBASE is a directory in which all users’ GRASS data are
89 stored. Within the GISDBASE, data are segregated into subdirecto‐
90 ries (called "locations") based on the map coordinate system used
91 and the geographic extent of the data. Each "location" directory
92 itself contains subdirectories called "mapsets"; each "mapset"
93 stores "data base elements" - the directories (e.g., the cell,
94 cellhd, vector, etc., directories) in which GRASS data files are
95 actually stored.
96
97 LOCATION_NAME
98 The user must choose to work with the data under a single GRASS lo‐
99 cation within any given GRASS session; this location is then called
100 the current GRASS location, and is specified by the variable LOCA‐
101 TION_NAME. The LOCATION_NAME is the GRASS data base location whose
102 data will be affected by any GRASS commands issued during the
103 user’s current GRASS session, and is a subdirectory of the current
104 GISDBASE. Each "location" directory can contain multiple "mapset"
105 directories (including the special mapset PERMANENT). Maps stored
106 under the same GRASS LOCATION_NAME (and/or within the same MAPSET)
107 must use the same coordinate system and typically fall within the
108 boundaries of the same geographic region (aka, "location").
109
110 MAPSET
111 Each "mapset" contains a set of maps relevant to the LOCATION_NAME
112 directory in which it appears. Each LOCATION_NAME can contain mul‐
113 tiple mapsets. (Mapsets which fall under the same LOCATION_NAME all
114 contain data geographically relevant to the LOCATION_NAME, and all
115 store data in the same map coordinate system. Frequently, maps are
116 placed into different mapsets to distinguish file ownership - e.g.,
117 each user might have one or more own mapset(s), storing any maps
118 that the user has created and/or are relevant to the own work.)
119 During each GRASS session, the user must choose one mapset to be
120 the current mapset; the current mapset setting is given by MAPSET,
121 and is a subdirectory of LOCATION_NAME. During a single GRASS ses‐
122 sion, the user can use available data in any of the mapsets stored
123 under the current LOCATION_NAME directory that are in the user’s
124 mapset search path and accessible by the user. However, within a
125 single GRASS session, the user only has write access to data stored
126 under the current mapset (specified by the variable MAPSET).
127
128 Each "mapset" stores GRASS data base elements (i.e., the directories in
129 which GRASS data files are stored). Any maps created or modified by
130 the user in the current GRASS session will be stored here. The MAPSET
131 directory PERMANENT is generally reserved for the set of maps that form
132 the base set for all users working under each LOCATION_NAME.
133
134 Once within a GRASS session, GRASS users have access only to the data
135 under a single GRASS data base directory (the current GRASS data base,
136 specified by the variable GISDBASE), and to a single GRASS location di‐
137 rectory (the current location, specified by the variable LOCA‐
138 TION_NAME). Within a single session, the user may only modify the data
139 in the current mapset (specified by the variable MAPSET), but may use
140 data available under other mapsets under the same LOCATION_NAME.
141
142 All of these names must be legal names on the user’s current system.
143
144 The full path to the current mapset is determined from GISDBASE, LOCA‐
145 TION_NAME, MAPSET variables, in the example above: /opt/grass‐
146 data/spearfish/PERMANENT. The full path can be printed using g.gisenv
147 by providing multiple variables:
148 g.gisenv get=GISDBASE,LOCATION_NAME,MAPSET sep=’/’
149 /opt/grassdata/nc_spm_08_grass7/user1
150
152 The output from g.gisenv when invoked without arguments is directly us‐
153 able by Bash. The following command will cast each variable into the
154 UNIX environment:
155 eval `g.gisenv`
156 This works only for Bash, sh, ksh, etc. The format of the output is not
157 compatible with some other UNIX shells.
158
159 By default the GRASS variables are stored in gisrc file (defined by en‐
160 vironmental variable GISRC). If store=mapset is given then the vari‐
161 ables are stored in <gisdbase>/<location>/<mapset>/VAR after the cur‐
162 rent GRASS session is closed.
163
164 GRASS Debugging
165 To print debugging messages, the variable DEBUG must be set to level
166 equal or greater than 0:
167 g.gisenv set="DEBUG=3"
168 Levels: (recommended levels)
169
170 • 0 - silence
171
172 • 1 - message is printed once or few times per module
173
174 • 3 - each row (raster) or line (vector)
175
176 • 5 - each cell (raster) or point (vector)
177 To disable debugging messages:
178 g.gisenv unset="DEBUG"
179 The variable DEBUG controls debugging messages from GRASS libraries and
180 modules.
181
182 Similarly WX_DEBUG controls debugging messages from wxGUI.
183
185 g.access, g.filename, g.findfile, g.mapsets
186
187 See also variables list
188
190 Michael Shapiro, U.S.Army Construction Engineering Research Laboratory
191
193 Available at: g.gisenv source code (history)
194
195 Accessed: Saturday Oct 28 18:17:20 2023
196
197 Main index | General index | Topics index | Keywords index | Graphical
198 index | Full index
199
200 © 2003-2023 GRASS Development Team, GRASS GIS 8.3.1 Reference Manual
201
202
203
204GRASS 8.3.1 g.gisenv(1)