-
Notifications
You must be signed in to change notification settings - Fork 15
/
obis_mpa_belgium.Rmd
44 lines (34 loc) · 981 Bytes
/
obis_mpa_belgium.Rmd
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
---
title: "obis_mpa_belgium"
output: github_document
---
```{r setup, include=FALSE, message = FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(sf)
library(dplyr)
library(robis)
source("R-code/wdpar-package.R")
# robis::occurrence() expect filtering polygons in a well-known-text represerntation (aka WKT)
extract_polygon_geometry <- function(polygon) {
polygon %>%
sf::st_geometry() %>%
sf::st_as_text()
}
```
## Global WDPA dataset flitered to Belgium
```{r wpda}
x <- sf::read_sf("~/data/WDPA_WDOECM_Apr2021_Public_marine.gpkg") %>%
dplyr::filter(ISO3 %in% "BEL")
```
## Extract occurence data from OBIS
```{r obis}
# gets the occurrence data for a single multipolygon (one row of WDPA table)
get_one_mpa <- function(x, key){
robis::occurrence(geometry = sf::st_as_text(sf::st_convex_hull(sf::st_geometry(x))))
}
bel_spoc <- x %>%
dplyr::rowwise() %>%
dplyr::group_map(get_one_mpa,
.keep = TRUE) %>%
dplyr::bind_rows()
```