Skip to content

Commit 7b59c49

Browse files
committed
improves grass desc
1 parent 850ba5d commit 7b59c49

File tree

1 file changed

+41
-19
lines changed

1 file changed

+41
-19
lines changed

10-gis.Rmd

Lines changed: 41 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -436,25 +436,47 @@ london_streets = dplyr::select(london_streets, osm_id)
436436

437437
As a convenience to the reader, one can attach `london_streets` to the global environment using `data("london_streets", package = "spDataLarge")`.
438438

439-
Now that we have the data, we can go on and initiate a GRASS\index{GRASS} session, i.e., we have to create a GRASS spatial database.
440-
<!-- The GRASS geodatabase \index{spatial database} system is based on SQLite. -->
441-
<!-- Consequently, different users can easily work on the same project, possibly with different read/write permissions. -->
442-
<!-- However, one has to set up this spatial database\index{spatial database} (also from within R), and users used to a GIS GUI\index{graphical user interface} popping up by one click might find this process a bit intimidating in the beginning. -->
443-
<!-- First of all, the GRASS database requires its own directory, and contains a location (see the [GRASS GIS Database](https://grass.osgeo.org/grass77/manuals/grass_database.html) help pages at [grass.osgeo.org](https://grass.osgeo.org/grass77/manuals/index.html) for further information). -->
444-
<!-- The location in turn simply contains the geodata for one project. -->
445-
<!-- Within one location, several mapsets can exist and typically refer to different users. -->
446-
<!-- PERMANENT is a mandatory mapset and is created automatically. -->
447-
<!-- It stores the projection, the spatial extent and the default resolution for raster data. -->
448-
<!-- In order to share geographic data with all users of a project, the database owner can add spatial data to the PERMANENT mapset. -->
449-
<!-- Please refer to @neteler_open_2008 and the [GRASS GIS quick start](https://grass.osgeo.org/grass77/manuals/helptext.html) for more information on the GRASS spatial database\index{spatial database} system. -->
450-
451-
<!-- You have to set up a location and a mapset if you want to use GRASS\index{GRASS} from within R. -->
452-
<!-- First of all, we need to find out if and where GRASS 7 is installed on the computer. -->
453-
454-
<!-- ```{r 09-gis-27, eval=FALSE} -->
455-
<!-- library(link2GI) -->
456-
<!-- link = findGRASS() -->
457-
<!-- ``` -->
439+
Now that we have the data, we can go on and initiate a GRASS\index{GRASS} session.
440+
First of all, we need to find out if and where GRASS is installed on the computer.
441+
442+
```{r 09-gis-27, eval=FALSE}
443+
library(link2GI)
444+
link = findGRASS()
445+
```
446+
447+
GRASS GIS differs from many other GIS software in its approach for handling input data -- it puts all of the input data in a GRASS spatial database.
448+
The GRASS geodatabase \index{spatial database} system is based on SQLite.
449+
Consequently, different users can easily work on the same project, possibly with different read/write permissions.
450+
However, one has to set up this spatial database\index{spatial database} (also from within R), and users might find this process a bit intimidating in the beginning.
451+
First of all, the GRASS database requires its own directory, which, in turn, contains a location (see the [GRASS GIS Database](https://grass.osgeo.org/grass80/manuals/grass_database.html) help pages at [grass.osgeo.org](https://grass.osgeo.org/grass80/manuals/index.html) for further information).
452+
The location stores the geodata for one project or one area.
453+
Within one location, several mapsets can exist that typically refer to different users or different tasks.
454+
Each location also has PERMANENT -- a mandatory mapset that is created automatically.
455+
PERMANENT stores the projection, the spatial extent and the default resolution for raster data.
456+
In order to share geographic data with all users of a project, the database owner can add spatial data to the PERMANENT mapset.
457+
So, to sum it all up -- the GRASS geodatabase may contain many locations (all data in one location have the same CRS), and each location can store many mapsets (groups of datasets).
458+
Please refer to @neteler_open_2008 and the [GRASS GIS quick start](https://grass.osgeo.org/grass80/manuals/helptext.html) for more information on the GRASS spatial database\index{spatial database} system.
459+
460+
Now, you have to set up a location and a mapset if you want to use GRASS\index{GRASS} from within R.
461+
462+
<!--toDo:jn-->
463+
<!--improve the next code chunk-->
464+
465+
```{r, eval=FALSE, echo=FALSE}
466+
# remotes::install_github("rsbivand/rgrass")
467+
library(rgrass7)
468+
grass_path = link$instDir[[1]]
469+
470+
initGRASS(grass_path,
471+
home = tempdir(), # home parameter necessary under UNIX-based systems
472+
gisDbase = tempdir(), SG = london_streets, override = TRUE)
473+
474+
initGRASS(gisBase = grass_path,
475+
home = tempdir(), # home parameter necessary under UNIX-based systems
476+
gisDbase = tempdir(), SG = as(london_streets, "Spatial"),
477+
location = "london", mapset = "PERMANENT", override = TRUE)
478+
```
479+
458480

459481
<!-- `link` is a `data.frame` which contains in its rows the GRASS 7 installations on your computer. -->
460482
<!-- Here, we will use a GRASS 7\index{GRASS} installation. -->

0 commit comments

Comments
 (0)