1grass_database(1)           GRASS GIS User's Manual          grass_database(1)
2
3
4

GRASS GIS Database

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  in‐
35       formation  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 re‐
86       gion’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 us‐
94       ing 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  re‐
131       projection 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
140       After  launching  GRASS  GIS for the first time, the GUI opens in a de‐
141       fault Location world_latlong_wgs84.  From  there  a  new  Location  and
142       Mapset can be created.
143
144       GRASS  GIS  can  be  also  started  with a given Database, Location and
145       Mapset from the command line. For example, the following will start  in
146       a given Mapset with only command line interface:
147       # Linux, Mac, *BSD, ...:
148       grass --text ~/grassdata/nc_spm_08_grass7/user1
149       # Windows
150       grass --text D:\grassdata\nc_spm_08_grass7\user1
151       And  the following will create the given Location with projection given
152       by the EPSG code and it will start the default interface (GUI  or  com‐
153       mand line):
154       # Linux, Mac, *BSD, ...:
155       grass -c EPSG:5514:3 ~/grassdata/mylocation
156       # Windows
157       grass -c EPSG:5514:3 D:\grassdata\mylocation
158       See grass command manual for more details.
159
160   Creating a New Location with the Location Wizard
161       The GUI provides a graphical Location Wizard which lets you easily cre‐
162       ate a new Location for your own data. You will be guided through a  se‐
163       ries of dialogues to browse and select predefined projections or to de‐
164       fine custom projections.
165
166       The most convenient way of using Location Wizard is creating new  Loca‐
167       tion based on a georeferenced file, such as Shapefile or GeoTIFF, or by
168       selecting the corresponding EPSG projection code.   In  case  of  using
169       georeferenced file, you are asked whether the data itself should be im‐
170       ported into the new Location.  The default region is then set to  match
171       imported map.
172
173       If  data were already imported, you can add them into the Layer Manager
174       now and display them.  More data can be  imported  into  the  Location,
175       e.g.  using  import  options in the File menu in Layer Manager or r.im‐
176       port.
177

See also

179        GRASS GIS Reference Manual
180       GRASS GIS startup program manual page
181       Importing data on GRASS Wiki
182       r.import, v.import, r.external, v.external, r.proj, v.proj,
183
184       Main index | Topics index | Keywords index | Graphical index | Full in‐
185       dex
186
187       © 2003-2023 GRASS Development Team, GRASS GIS 8.3.1 Reference Manual
188
189
190
191GRASS 8.3.1                                                  grass_database(1)
Impressum