-
Notifications
You must be signed in to change notification settings - Fork 8
/
tidy-slides.qmd
266 lines (180 loc) · 4.93 KB
/
tidy-slides.qmd
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
---
# Slide format:
format: revealjs
title: Tidy geographic data
subtitle: "with sf, dplyr, ggplot2, geos and friends"
bibliography: references.bib
---
::: notes
Intro slide
:::
# Introduction
## Session overview
![](images/paste-1.png)
Source: [pretalx.earthmonitor.org/opengeohub-summer-school-2023/schedule/v/0.7/](https://pretalx.earthmonitor.org/opengeohub-summer-school-2023/schedule/v/0.7/)
::: notes
Parallel to the Python session.
:::
## About me
::: columns
::: {.column .incremental width="50%"}
- Associate Professor, University of Leeds
- Head of Data and Digital at Active Travel England
- Author of [Geocomputation with R](https://r.geocompx.org)
- Research: geocomputation + transport decarbonisation
- Research question: where to build bike lanes?
:::
::: {.column width="50%"}
```{=html}
<!---
Iframe:
--->
```
Source: [www.npt.scot](https://nptscot.github.io/#11.34/55.8656/-4.1742)
![](images/paste-19.png)
```{=html}
<!---
<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d2378.703742821301!2d-1.555293684150781!3d53.80140398008763!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x48795d0d0b0b0e0f%3A0x9e1b0b0b0b0b0b0b!2sUniversity%20of%20Leeds!5e0!3m2!1sen!2suk!4v1629914398803!5m2!1sen!2suk" width="400" height="300" style="border:0;" allowfullscreen="" loading="lazy"></iframe>
--->
```
:::
:::
## From research to impact
<iframe src="https://nptscot.github.io/#11.34/55.8656/-4.1742" width="800" height="600" style="border:0;" allowfullscreen loading="lazy">
</iframe>
## Geocomputation to tackle the climate crisis
<iframe src="https://ourworldindata.org/grapher/global-co2-fossil-plus-land-use" loading="lazy" style="width: 100%; height: 600px; border: 0px none;">
</iframe>
## System dependencies
![](images/paste-2.png)
Source: @pebesma2018
::: notes
System dependencies.
:::
## System dependencies: code
- `sf` startup message:
```{r}
#| echo: true
sf::sf_extSoftVersion()
```
- On Linux `sf` uses system installations of GDAL, GEOS and PROJ.4:
```{bash}
#| echo: true
gdalinfo --version
which gdal-config
```
- On Windows, `sf` ships with binary versions installed
## Development environments {.smaller}
::: columns
::: {.column width="50%"}
### RStudio
- Pro: works out of the box
- Pro: Great R autocomplete
- Pro: Features for data science + R package development
- Con: A bit R specific
### VS Code
- Pro: Works with many languages
- Pro: Unbeatable ecosystem of extensions
- Pro: Advanced features such as copilot + works in Codespaces
- Con: A bit fiddly to set up, rough edges when using R
:::
::: {.column width="50%"}
![](images/paste-4.png)
![](images/paste-3.png)
:::
:::
## RStudio
![](images/paste-4.png)
## VS Code
![](images/paste-3.png)
# Which IDE to you use? {.incremental}
::: columns
::: {.column width="50%"}
<iframe src="https://fosstodon.org/@robinlovelace/110920501943601698/embed" class="mastodon-embed" style="max-width: 100%; border: 0" width="400" allowfullscreen="allowfullscreen">
</iframe>
```{=html}
<script src="https://fosstodon.org/embed.js" async="async"></script>
```
:::
::: column
::: incremental
- ![](images/paste-7.png)
:::
:::
:::
## Results
::: columns
::: {.column width="50%"}
- On Twitter:
![](images/paste-8.png)
:::
::: column
::: incremental
- On Mastodon:
- ![](images/paste-9.png)
:::
:::
:::
## On Mattermost
![](images/paste-10.png)
## Mattermost results
![](images/paste-20.png)
## Mattermost results 2...
![](images/paste-21.png)
# Part 1: Sections 2 and 3
## Key features of `sf`
![](images/paste-5.png)
Source: @lovelace2019
## `sf` functions
![](images/paste-6.png)
Source: @pebesma2018
## Practical (\~13:30-14:30)
Work through the code in Section 2 and 3 at [ogh23.robinlovelace.net/tidy](https://ogh23.robinlovelace.net/tidy) and answer the questions at your own pace.
```{r}
#| message: false
#| warning: false
# Install remotes if not already installed
if (!requireNamespace("remotes")) {
install.packages("remotes")
}
```
```{r}
# Some of the packages we'll use
pkgs = c(
"sf",
"tidyverse",
"geos",
"spData"
)
```
```{r}
#| eval: false
#| echo: true
remotes::install_github("robinlovelace/opengeohub2023")
```
```{r}
#| echo: true
#| message: false
#| warning: false
sapply(pkgs, require, character.only = TRUE)
```
# Part 2: Sections 4 to 7
## geos
![](images/paste-13.png)
## rsgeo
![](images/paste-18.png)
## rsgeo II
![](images/paste-17.png)
## tidyverse alternatives
![](images/paste-12.png)
## Comparing R with Python
Inspiration: Working with [Spatial Data in Python](https://geobgu.xyz/presentations/p_2023_ogh/) materials
![](images/paste-14.png)
## Vector data in R/Python
Aim: cross-compare approaches
Source: [Python version](https://geobgu.xyz/presentations/p_2023_ogh/01-vector.html#plotting-1) and [R version](https://ogh23.robinlovelace.net/tidy#worked-example-data-from-poznan)
::: {layout-ncol="2"}
![](images/paste-15.png)
![](images/paste-16.png)
:::
# References