This project will map the locations of volcanoes in Alaska, with information published by the Alaska Division of Geological & Geophysical Surveys, located at https://avo.alaska.edu/pdfs/AKvolclatlong.zip.

First, we’ll load the libraries needed, and the volcano data.

library(leaflet)
library(readxl)
volcanoes <- read_excel('C:/Users/dmartin/Documents/AKvolclatlong/AKvolclatlong.xls')

There are some volcanoes with a positive longitude, which makes the display on the map look strange. This will fix that issue.

volcanoes$Longitude <- abs(volcanoes$Longitude) * -1

I also downloaded a volcano icon to use on the leaflet map. Icon made by Freepik from www.flaticon.com.

volcanoicon <- makeIcon('C:/Users/dmartin/Documents/AKvolclatlong/volcano.png', iconWidth = 16, iconHeight = 16, iconAnchorX = 8, iconAnchorY = 8)

Next, create the map using the volcano data and icon.

volcanomap <- volcanoes %>%
  leaflet() %>%
  addTiles() %>%
  addMarkers(popup = volcanoes$Volcano, icon = volcanoicon, clusterOptions = markerClusterOptions())
volcanomap