This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(raster) | |
library(sf) | |
library(exactextractr) | |
library(rnaturalearth) | |
library(tidyverse) | |
library(lubridate) | |
library(ebirdst) | |
# averaging and subsetting ---- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(sf) | |
library(rnaturalearth) | |
# transform an sf object, moving the dateline seam to edge of projection | |
# | |
# x: sf containing spatial features | |
# crs: character; proj4 string for new projection | |
# | |
# return: | |
# sf containing spatial features in new projection |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rasterVis) | |
library(ebirdst) | |
library(sf) | |
library(tigris) | |
library(dplyr) | |
# download data from aws | |
species <- "Swainson's Thrush" | |
dl_path <- ebirdst_download(species) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(auk) | |
library(tidyverse) | |
tf <- tempfile() | |
system.file("extdata/ebd-sample.txt", package = "auk") %>% | |
auk_ebd() %>% | |
auk_species(species = c("Canada Jay", "Blue Jay")) %>% | |
auk_country(country = c("US", "Canada")) %>% | |
auk_bbox(bbox = c(-100, 37, -80, 52)) %>% | |
auk_date(date = c("2012-01-01", "2012-12-31")) %>% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(gganimate) | |
library(hrbrthemes) | |
# generate a jagged polygon | |
set.seed(1) | |
n <- 60 | |
theta <- (runif(n) + 1:n - 1) * 2 * pi / n | |
radius <- rgamma(n, shape = 3) | |
radius <- radius / max(radius) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(sp) | |
library(raster) | |
library(rgeos) | |
set_RGEOS_polyThreshold(0) | |
set_RGEOS_warnSlivers(TRUE) | |
set_RGEOS_dropSlivers(FALSE) | |
# function to rigidly shift polygon | |
# only works for simple polygon objects with a single polygon | |
shift_poly <- function(p, x, y) { |