1grass_database(1) Grass User's Manual grass_database(1)
2
3
4
6 A GRASS GIS Database is simply a set of directories and files with cer‐
7 tain structure which GRASS GIS works efficiently with. Location is a
8 directory with data related to one geographic location or a project.
9 All data within one Location has the same cartographic projection. A
10 Location contains Mapsets and each Mapset contains data related to a
11 specific task, user or a smaller project. Within each Location, a
12 mandatory PERMANENT Mapset exists which can contain commonly used data
13 within a Location such as base maps. PERMANENT Mapset also contains
14 metadata related to Location such as projection. When GRASS GIS is
15 started it connects to a Database, Location and Mapset specified by the
16 user.
17
18 Fig. 1: GRASS GIS Database structure as visible to the user
19
20 GRASS GIS Database
21 All data for GRASS GIS must be in GRASS GIS Database which is a direc‐
22 tory (visible on the disk) containing subdirectories which are GRASS
23 Locations. User can have one or more of Databases on the disk. Typi‐
24 cally users have one directory called grassdata in their home direc‐
25 tory. In multi-user environment users often have a grassdata directory
26 mounted as a network directory (network file system). For teams, a
27 centralized GRASS DATABASE would be defined in a shared network file
28 system (e.g. NFS).
29
30 GRASS GIS Databases can be safely copied or moved as any other directo‐
31 ries. Don’t be confused with (relational) databases which are used in
32 GRASS GIS to hold attribute data and might be part of the GRASS GIS
33 Database. From user point of view, GRASS GIS Database with all its
34 data in it is similar to, e.g. PostGIS, database, as it stores all
35 information inside in a specific format and is accessible by specific
36 tools. GRASS GIS Databases is in GRASS GIS often called GISDBASE or
37 DATABASE.
38
39 GRASS Locations
40 Location is a directory which contains GRASS Mapsets which are its sub‐
41 directories. All data in one Location have the same projection (coor‐
42 dinate system, datum). Each Location must contain Mapset called PERMA‐
43 NENT. Typically, a Location contains all data related to one project
44 or a geographic area (geographic location or region). Alternatively,
45 Location can simply contain all data in a given projection.
46
47 GRASS Locations can be safely copied or moved as any other directories.
48 Compressed Location is usually what GRASS users exchange between each
49 other when they want to share a lot of data. For example, GRASS GIS
50 sample data are provided as Locations.
51
52 Don’t be confused with location as a place (file or directory) in a
53 file system. The word location in GRASS Location refers to a location
54 or area on Earth (or whatever is applicable). Users and programmers
55 familiar with relational databases such as PostgreSQL can view Location
56 as an individual database inside the system or a storage area which
57 would be equivalent to GRASS GIS Database. Mapsets in a Locations are
58 like namespaces or schemas inside a database.
59
60 GRASS Mapsets
61 Mapsets contains the actual data, mostly geospatial data, referred to
62 as maps in GRASS GIS. Mapsets are a tool for organizing maps in a
63 transparent way as well as a tool for isolating different tasks to pre‐
64 vent data loss.
65
66 GRASS GIS is always connected to one particular Mapset. GRASS GIS mod‐
67 ules can create, modify, change, or delete a data only in the current
68 Mapset. By default, only the data from the current Mapset and PERMA‐
69 NENT Mapset are visible. Using g.mapsets module or in GUI other Mapsets
70 can be made visible and seamlessly accessible. All data are available
71 for reading when Mapset is specified explicitly, for example to access
72 map streets in Mapset new_highway user can use streets@new_highway.
73 For maps which are in the current or PERMAENT Mapsets or Mapsets sets
74 as visible (accessible), there is no need to use @mapset syntax.
75
76 Mapsets are used to store maps related to one project, smaller project,
77 specific task, issue or subregions. In multi-user environment, when a
78 team works together on one project, Mapsets support simultaneous access
79 of several users to the maps stored within the same Location. Besides
80 access to his or her own Mapset, each user can also read maps in PERMA‐
81 NENT Mapsent and in other users’ Mapsets when set. However, each user
82 can modify or remove only the maps in his or her own Mapset.
83
84 Besides the geospatial data, Mapset holds additional data such as color
85 tables (managed e.g. by r.colors) and the current computational
86 region’s extent and resolution stored in a file called WIND and managed
87 by g.region.
88
89 Mapsets can be copied and moved as directories, however only when it is
90 clear that the projections of both Locations (as reported by g.proj)
91 match each other. Since this is sometimes hard to to establish, it is
92 recommended to use r.proj or v.proj to reproject the data. The files
93 and directories should not be moved or modified directly, but only
94 using GRASS GIS tools.
95
96 The role of the PERMANENT Mapset
97 When creating a new Location, GRASS GIS automatically creates a special
98 Mapset called PERMANENT where the core data for the Location are
99 stored.
100
101 Since the maps in PERMANENT Mapset are visible from all the other
102 Mapsets, it can be used to store the base maps (base cartography), data
103 common to all projects or needed for different analyses done is sepa‐
104 rate Mapsets.
105
106 In multi-user environment, data in the PERMANENT Mapset can only be
107 added, modified or removed by the owner of the PERMANENT Mapset; how‐
108 ever, they can be accessed, analyzed, and copied into their own Mapset
109 by the other users. The PERMANENT Mapset is useful for providing gen‐
110 eral spatial data (e.g. an elevation model), accessible but write-pro‐
111 tected to all users who are working in the same Location as the data‐
112 base owner. To manipulate or add data to PERMANENT, the owner can
113 start GRASS GIS and choose the relevant Location and the PERMANENT
114 Mapset.
115
116 The PERMANENT Mapset also contains the DEFAULT_WIND file which holds
117 the default computational region’s extent and resolution values for the
118 Location (which all Mapsets will inherit when they are created). Users
119 have the option of switching back to the default region at any time.
120
121 Importing, exporting and linking data
122 GRASS GIS works only with data which are imported into a GRASS Data‐
123 base, so all data needs to be imported, e.g. by r.in.gdal or highly
124 convenient r.import, before the actual analysis. Data in GRASS Datable
125 can be exported using for example r.in.gdal in case of raster maps.
126
127 For cases when import is not desirable, an option to link external data
128 exists. Projection of the linked data must match the Location’s pro‐
129 jection otherwise the external data cannot be linked. (Linking data in
130 different projection is not allowed as it would require on-the-fly
131 reprojection which could cause inconsistencies in the data.
132
133 For example, module r.external links external raster data, so that the
134 data are accessible in GRASS Database as standard raster maps. Simi‐
135 larly for newly created maps, r.external.out setups a format and direc‐
136 tory where the actual data will be stored, however in GRASS Database
137 the data will be created as standard maps.
138
139 Starting GRASS GIS using GUI
140 After launching GRASS GIS, the startup window will open (Fig. 2).
141
142 Fig. 2: GRASS GIS startup window The startup windows provides these
143 functions:
144
145 1 Selecting the GRASS GIS Database directory.
146
147 2 Selecting the Location (e.g. a project or area). See the Loca‐
148 tion Wizard (4) for creating new Locations.
149
150 3 Selecting the Mapset (a subproject or task). Creating a new
151 Mapset requires only name.
152
153 4 The Location Wizard for creating new Locations based for exam‐
154 ple, on existing georeferenced file or EPSG code.
155
156 5 Download a sample Location from the Internet.
157
158 6 Start GRASS GIS once you have selected an existing Location and
159 Mapset or defined a new one. The graphical user interface wxGUI
160 will open and provide you with a menu system, map visualization
161 tool, digitizer, and more.
162
163 Starting GRASS GIS using command line
164 GRASS GIS can be started with given Database, Location and Mapset from
165 the command line. For example, the following will start in a given
166 Mapset with only command line interface:
167 grass78 --text ~/grassdata/mylocation/mymapset
168 And the following will create the given Location with projection given
169 by the EPSG code and it will start the default interface (GUI or com‐
170 mand line):
171 grass78 -c EPSG:5514:3 ~/grassdata/mylocation
172 See grass command manual for more details.
173
174 Creating a New Location with the Location Wizard
175 The wxGUI graphical user interface provides a graphical Location Wizard
176 which lets you easily create a new Location for your own data. You will
177 be guided through a series of dialogues to browse and select predefined
178 projections or to define custom projections.
179
180 The most convenient way of using Location Wizard is creating new Loca‐
181 tion based on a georeferenced file, such as Shapefile or GeoTIFF, or by
182 selecting the corresponding EPSG projection code. In case of using
183 georeferenced file, you are asked whether the data itself should be
184 imported into the new Location. The default region is then set to
185 match imported map.
186
187 After defining a new Location, wxGUI starts automatically. If data
188 were already imported, you can add them into the Layer Manager now and
189 display them. More data can be imported into the Location, e.g. using
190 import options in the File menu in Layer Manager or r.import.
191
193 GRASS GIS 7 Reference Manual
194 GRASS GIS 7 startup program manual page
195 Importing data on GRASS Wiki
196 r.import, v.import, r.external, v.external, r.proj, v.proj,
197
198 Main index | Topics index | Keywords index | Graphical index | Full
199 index
200
201 © 2003-2019 GRASS Development Team, GRASS GIS 7.8.2 Reference Manual
202
203
204
205GRASS 7.8.2 grass_database(1)