-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexplore_dumping.Rmd
More file actions
58 lines (45 loc) · 1.13 KB
/
explore_dumping.Rmd
File metadata and controls
58 lines (45 loc) · 1.13 KB
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
---
title: "Ocean Dumping / Disposal"
author: "Ben Best"
date: "`r Sys.Date()`"
output:
html_document:
toc: true
toc_float: true
code_folding: hide
editor_options:
chunk_output_type: console
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, warning = F, message = F)
```
## Load
```{r}
# packages
if (!require("librarian")){
install.packages("librarian")
library(librarian)
}
librarian::shelf(
dplyr, DT, glue, here, mapview, sf)
select <- dplyr::select
mapviewOptions(fgb = FALSE)
source(here::here("libs/db.R")) # defines variables: con, dir_gdrive
```
* [Ocean Disposal Sites | InPort](https://www.fisheries.noaa.gov/inport/item/54193)
```{r}
gpkg <- file.path(dir_gdrive, "data/US-ocean-disposal-sites/OceanDisposalSite.gpkg")
st_layers(gpkg)
dumps <- st_read(gpkg, "OCEANDISPOSALSITE") %>%
st_transform(4326)
stations <- st_read(con, "stations")
hull <- st_convex_hull(st_union(stations))
x <- st_intersects(dumps, hull, sparse = F)[,1]
dumps_ply <- dumps[x,]
dumps_pts <- st_centroid(dumps_ply)
mapview(dumps_ply) +
mapview(dumps_pts)
dumps_ply %>%
st_drop_geometry() %>%
datatable()
```