I decided to examine the species distribution of Northern Gannets and explore their sightings and distribution according to their location and the month they were spotted. I wanted to explore if these birds are often seen more southward or northward during the winter and summer months respectively. To do this, I performed an overlay of the average winter temperature in the US, the elevation, and colored the different observations based on the season/month they were observed. The coral color of the observations represent the hotter months of the year, while the royal blue color of the observations represent the colder months. The colors in between these two colors represent the temperate seasons such as spring and fall. I am unable to create a sliding scale to represent average winter temperature in the US, so if my legend, I only included the high and low colors, which are red and blue respectively. I labeledd the cities of Boston, New York, and Cape May as they seem to have the most observations in their general area. It seems that there are some Northern Gannets that migrate northward by Maine for the Summer months, but the Winter migration observations seem to be more mixed.
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ ggplot2 3.4.4 ✔ tibble 3.2.1
## ✔ lubridate 1.9.3 ✔ tidyr 1.3.1
## ✔ purrr 1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(leaflet)
library(sf)
## Linking to GEOS 3.11.2, GDAL 3.7.2, PROJ 9.3.0; sf_use_s2() is TRUE
library(rgbif)
library(dplyr)
library(rnaturalearth)
library(RColorBrewer)
library(raster)
## Loading required package: sp
##
## Attaching package: 'raster'
##
## The following object is masked from 'package:dplyr':
##
## select
library(sp)
setwd("C:/Users/alyss/Downloads")
northern_gannet_gbif <- occ_search(scientificName = "Morus bassanus", country = "US", hasCoordinate = TRUE) $data
month_colors <- colorBin(palette = c("royalblue", "coral", "coral", "royalblue"), domain = northern_gannet_gbif$month, 12)
unzip("Tavg_winter_historical.zip")
temp_data <- raster("Tavg_winter_historical.tif")
temp_color <- colorRampPalette(c("red", "blue"))
crs(temp_data)
## Coordinate Reference System:
## Deprecated Proj.4 representation: +proj=longlat +datum=WGS84 +no_defs
## WKT2 2019 representation:
## GEOGCRS["unknown",
## DATUM["World Geodetic System 1984",
## ELLIPSOID["WGS 84",6378137,298.257223563,
## LENGTHUNIT["metre",1]],
## ID["EPSG",6326]],
## PRIMEM["Greenwich",0,
## ANGLEUNIT["degree",0.0174532925199433],
## ID["EPSG",8901]],
## CS[ellipsoidal,2],
## AXIS["longitude",east,
## ORDER[1],
## ANGLEUNIT["degree",0.0174532925199433,
## ID["EPSG",9122]]],
## AXIS["latitude",north,
## ORDER[2],
## ANGLEUNIT["degree",0.0174532925199433,
## ID["EPSG",9122]]]]
cities <- data.frame(city = c("Boston", "New York City", "Cape May"),
long = c(-71.057083, -73.935242, -74.9111),
lat = c(42.361145, 40.730610, 38.9368))
leaflet() %>%
setView(lng= -76.811, lat = 37.671, zoom = 4) %>%
addTiles() %>%
addProviderTiles("USGS.USTopo")%>%
addRasterImage(temp_data, colors = c("red", "blue"), opacity = 0.3) %>%
addCircleMarkers(
data = northern_gannet_gbif,
lng = ~northern_gannet_gbif$decimalLongitude,
lat = ~northern_gannet_gbif$decimalLatitude,radius = 0.01, fillOpacity = 0.5,
color = ~month_colors(month))%>%
addLegend(
position = "topleft",
values = unique(northern_gannet_gbif$month),
colors = month_colors(unique(northern_gannet_gbif$month)),
labels = unique(northern_gannet_gbif$month),
title= "Months of the Year by Number") %>%
addLegend(
position = "bottomright",
title = "Average Winter Temperature",
colors = c("red", "blue"), labels = c("High", "Low"), opacity = 0.3) %>%
addMarkers(data = cities, lng = ~long, lat = ~lat, label = ~city)