-
Notifications
You must be signed in to change notification settings - Fork 4
/
link2gi2018.html
310 lines (218 loc) · 9.71 KB
/
link2gi2018.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
<!DOCTYPE html>
<html>
<head>
<title>link2GI - consistent linking of Open Source GIS with R</title>
<meta charset="utf-8">
<meta name="author" content="Chris Reudenbach Faculty of Geography University of Marburg (Germany)" />
<link href="libs/remark-css/default.css" rel="stylesheet" />
<link href="libs/remark-css/default-fonts.css" rel="stylesheet" />
</head>
<body>
<textarea id="source">
class: center, middle, inverse, title-slide
# link2GI - consistent linking of Open Source GIS with R
### Chris Reudenbach <br/> Faculty of Geography University of Marburg (Germany)
### GEOSTAT August 2018
---
## About me
- Geographer, Faculty of Geography at the Marburg University
responsible for all kinds of GI stuff
- originally a climatologist and remote sensing scientist of atmosphere shifted interest over to spatial vegetation analysis ecological modeling with an increasing passion for environmental modeling
- started with Pascal and Fortran between shell and python, and since some time R
- currently I work on a framework for reduction and standarization of autonomous retrieval, preprocessing and anaysis of low budget UAV based remote sensing data with focus on forest ecosystems
--
## Content
1. Aim, prerequisites and data
1. Some why and what questions
1. The basic functions
1. Usecases
---
class: center, middle
# Aim, prerequisites and data
---
## Aim
- renewing the statement of this week that mature GIS / RS tools can play a major role in the spatial `R` world beside that they are extremely useful
- providing some basic information for more simple access to `GRASS SAGA` and `OTB` software
- giving some hands on case studies
### Find slides and materials
https://gisma.github.io/link2gi2018/link2gi2018.html
https://github.com/gisma/link2gi2018
---
## Prerequisites
Briding to something means that you need at least two pillars and the bridge roadway itself. So please check:
### The R pillar
R needs the following packages (and their dependecies of course):
```r
install.packages(c("sf", "raster", "rgdal", "gdalUtils", "tools", "rgrass7", "sp", "RSAGA"))
# because of a pending CRAN update please install link2GI from github
devtools::install_github("gisma/link2GI", ref = "master")
# for the Canopy height model usecase you need to install uavRst
devtools::install_github("gisma/uavRst", ref = "master")
```
---
### The GIS pillar
You need at least one Installation of the following GIS software.
- For `GRASS`- and `SAGA-GIS` follow the [RQGIS installation instructions](https://github.com/jannes-m/RQGIS/blob/master/vignettes/install_guide.Rmd) as provided by Jannes Muenchow. For standalone GRASS you may have a look at the the [geostat2018 instructions](https://gitlab.com/veroandreo/grass-gis-geostat-2018) as provided by Veronica Andreos.
- For installing the `Orfeo Toolbox`, please follow these [installations instructions](https://www.orfeo-toolbox.org/CookBook/Installation.html).
---
### The data
Bridging from `R` to GIS means download the data and scripts for the exercises. This will take quite a while so better start now.
Executing the code you will create the folder *link2gi-master* in your home folder. During the tutorial it is assumed to be the root folder.
You may do it manually but please don't forget to adapt the path strings in the tutorial scripts.
```r
url <- "https://github.com/gisma/link2gi2018/archive/master.zip"
res <- curl::curl_download(url, paste0(tmpDir(),"master.zip"))
utils::unzip(zipfile = res, exdir = "~")
```
---
class: center, middle
# Some why and what questions
---
## Why using external software at all?
--
1. if you perform spatial analysis on heterogeneous and large data, it is simply a feature of good scientific practice to screen and take into account what already exists
--
2. it could be worth the effort thinking about using reliable, quality-controlled and optimized software tools
--
3. from my personal perspective, the main point of external software is that you can focus on the scientific and content-related issues instead of reinventing the wheel
--
## Why just another wrapper package?
The R community has some well known wrapper packages dealing with this topic as `rgdal`, `rgrass7`, `RSAGA`, `RQGIS` and so on...
### because despite the good packages simply some things do not work or are cumbersome
---
# What is cumbersome?
### Current situation
`R` is a low entry-level scripting language for geo-spatial tasks **and**
there is an increasing demand for (complex) spatio-temporal data analysis.
This leads to a significant increase in popularity among users.
--
### In daily use, the most common problems are:
- focus on well known software (R) **and** operating system (whatever)
--
- a comparatively complex software ecotope
--
- restricted user privileges
--
- every day workarounds means interactive / manual usage of external GIS software prevents effective workflows
--
- cumbesome experience with cross platform cross software expirience (not only starting with collaborative writing articles with Word)
easily to be continued...
---
## What would be desirable?
- from a typical R-User point of view without either sufficient privileges or not familiar with GIS-software or the operating system it seems to be at least **helpful** to reduce some of this issues
- from a teaching point of view it would be great to avoid the nightmare to adapt individual laptop configurations or lab restrictions.
- from a R-developer point of view it is helpful to enable the integration of fast and relieble algorithms of mature software systems
--
### This is what link2GI tries to do
- The [link2GI](https://CRAN.R-project.org/package=link2GI) package is a small tool for linking GRASS, SAGA GIS and Orfeo Toolbox (OTB) more consistent and with one line code to the R environment.
- It is focussing on both R users that are not operating system specialists or highly experienced GIS users as well as on fast prototying using of mature GIS algorithms
---
class: center, middle
# The basic features and functions
---
## Features of link2GI so far
--
- detects all/most existing intallations of `GRASS7, SAGA`, and `Orfeo Toolbox` (` GRASS 7.x +, SAGA 2.x +, OTB` - all releases)
--
- provides working temporary/permanent user envionments as required by the corresponding GIS software for command line and wrapper packages (`RSAGA`, `rgrass7`)
--
- simplifies `OTB` calls via a first list-based `OTB` wrapper
---
## Get an overview
```R
# load library
require(link2GI)
# find all GRASS GIS installations at the default search location
grass <- link2GI::findGRASS()
print(grass)
# find all SAGA installations at the default search location
saga <- link2GI::findSAGA()
print(saga)
# find all Orfeo Toolbox installations at the default search location
otb <- link2GI::findOTB()
print(otb)
```
---
---
## Let's use meuse with GRASS
```R
# get meuse data as sp object
require(link2GI)
require(sp)
require(sf)
# get meuse data as sf object
data(meuse)
meuse_sf = st_as_sf(meuse,
coords =
c("x", "y"),
crs = 28992,
agr = "constant")
# create a temporary GRASS linkage using the meuse data
linkGRASS7(meuse_sf,ver_select=1)
```
--
### Hands on
- Use the [vignette](https://github.com/gisma/link2gi2018/blob/master/R/vignette/link2gigeostat.Rmd) for more basic examples
- Dive into the usecases for getting an idea how to use link2GI
---
class: center, middle
# Usecases
---
# Usecases
- [SAGA & OTB basic usecase](https://github.com/gisma/link2gi2018/blob/master/R/usecases/saga-otb/useCaseSAGA-OTB.R)
- [Analysing the ECA&D climatic data - reloaded](https://github.com/gisma/link2gi2018/blob/master/R/usecases/grass/useCaseGRASS-Neteler2018.R)
- [beetle spread over high asia](https://github.com/gisma/link2gi2018/blob/master/R/usecases/cost-analysis/useCaseBeetle.R)
- [Canopy Height Model from UAV derived point clouds](https://github.com/gisma/link2gi2018/blob/master/R/usecases/uav-pc/useCaseCHM.R)
---
class: center, middle
# Thank you for attention
---
</textarea>
<script src="https://remarkjs.com/downloads/remark-latest.min.js"></script>
<script>var slideshow = remark.create({
"highlightStyle": "github",
"ratio": "4:3",
"highlightLines": true,
"countIncrementalSlides": false
});
if (window.HTMLWidgets) slideshow.on('afterShowSlide', function (slide) {
window.dispatchEvent(new Event('resize'));
});
(function() {
var d = document, s = d.createElement("style"), r = d.querySelector(".remark-slide-scaler");
if (!r) return;
s.type = "text/css"; s.innerHTML = "@page {size: " + r.style.width + " " + r.style.height +"; }";
d.head.appendChild(s);
})();</script>
<script>
(function() {
var i, text, code, codes = document.getElementsByTagName('code');
for (i = 0; i < codes.length;) {
code = codes[i];
if (code.parentNode.tagName !== 'PRE' && code.childElementCount === 0) {
text = code.textContent;
if (/^\\\((.|\s)+\\\)$/.test(text) || /^\\\[(.|\s)+\\\]$/.test(text) ||
/^\$\$(.|\s)+\$\$$/.test(text) ||
/^\\begin\{([^}]+)\}(.|\s)+\\end\{[^}]+\}$/.test(text)) {
code.outerHTML = code.innerHTML; // remove <code></code>
continue;
}
}
i++;
}
})();
</script>
<!-- dynamically load mathjax for compatibility with self-contained -->
<script>
(function () {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'https://cdn.bootcss.com/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_CHTML';
if (location.protocol !== 'file:' && /^https?:/.test(script.src))
script.src = script.src.replace(/^https?:/, '');
document.getElementsByTagName('head')[0].appendChild(script);
})();
</script>
</body>
</html>