# INBO CODING CLUB
25 February 2026
Welcome!
## Share your code snippet
If you want to share your code snippet, copy paste your snippet within a section of three backticks (```):
As an **example**:
```
library(tidyverse)
```
(*you can copy paste this example and add your code further down*)
## Yellow sticky notes
No yellow sticky notes online. Put your name + " | " and add a "*" each time you solve a challenge (see below).
## Participants
Name | Challenges
--- | ---
Damiano Oldoni | ***
Anja Leyman |
Falk Mielke | **
Adriaan Seynaeve |
Charlotte Van Moorleghem |*
Tosca Vanroy |
Florian Van Hecke | *
## Challenge 1
### Damiano's solution (example)
Copy paste this section to show your solutions.
```r
# dummy code
print("This is how to insert code.")
```
### Falk's Attempt
```r
mapview::mapview(
visits,
# zcol = "species",
zcol = "type",
col.regions = c(
"trees" = "darkgreen",
"shrubs" = "lightgreen"
), # [☇] `col.regions` must be in alphabetical order
alpha.regions = 0.4,
color = "red",
alpha = 0.6,
legend = TRUE,
layer.name = "Plants type",
popup = leafpop::popupTable(
visits,
zcol = c("species", "type")
),
map.types = c("OpenStreetMap"),
homebutton = TRUE # on by default
)
# %>% leafem::addMouseCoordinates() # on by default
```
### Robbie
```r
library(raster)
mapview(visits, zcol = "species", legend= T, map.types = "OpenStreetMap") %>%
leafem::addMouseCoordinates() %>%
leafem::addHomeButton(ext = extent(visits), group = "visits")
```
## Challenge 2
### Falk's Attempt
```r
labels <- c(
"tdiff_01" = "Average temperature fluctuation in January",
"tmin_01" = "Average maximum temperature in January",
"tmax_01" = "Average minimum temperature in January"
)
visibility <- c(
"tdiff_01" = TRUE,
"tmin_01" = FALSE,
"tmax_01" = FALSE
)
# layer <- "tdiff_01" # testing
create_temp_mapview_layer <- function(layer, global_minmax = TRUE) {
# color legend range options
if (global_minmax) {
# global temperature min/max for uniform legend
min_value_diff <- floor(min(terra::minmax(temperature)["min", ]))
max_value_diff <- ceiling(max(terra::minmax(temperature)["max", ]))
} else {
# you could do this layer-wise, but I prefer the "global" minmax
min_value_diff <- terra::minmax(temperature)["min", layer]
max_value_diff <- terra::minmax(temperature)["max", layer]
}
# create a color sequence
color_seq <- seq(from = min_value_diff, to = max_value_diff, by = 5)
# the map (is not displayed, but stored in a handle for return)
m_new <- mapview(
temperature[layer],
col.regions = viridis::magma(length(color_seq + 1)),
at = color_seq,
layer.name = labels[[layer]],
hide = !visibility[[layer]],
homebutton = FALSE
)
return(m_new)
}
# create all maps with an "sapply"
# the FUN is customized with a shorthand to allow setting options
# \(x) is a shorthand for function(x)
all_maps <- sapply(
names(temperature),
FUN = \(lyr) create_temp_mapview_layer(lyr, global_minmax = TRUE)
)
# show the maps
all_maps[["tdiff_01"]] +
all_maps[["tmin_01"]] +
all_maps[["tmax_01"]]
```
## Challenge 3