Final Project

Introduction

The goal of this project is to create a web page using R Markdown that features an interactive map created with Leaflet. The webpage is hosted on RPubs. I thought it would be fun and creative to create a map of top 10 places I would like visit sometime in the future. I understand that under the current circumstance we are in due to COVID-19, that traveling right now is not the best option. Hopefully one day in the not too distant future, I will be able to travel to the places that I have listed.

I created the .csv file containing all the Names, Latitudes, and Longitudes of the places I would to like to travel to. I found the coordinates to the locations using Google. I also included a pictures of the places. I had to include some html code to allow the photos to read into R. For example, I used the < img sr= “image.jpg” > code to insert an image. The images are labeled for reuse.

Read in data

places <- read.csv("/Users/estelafalcon/Downloads/places.csv",header = TRUE)

Here is what it looks like

str(places)
## 'data.frame':    10 obs. of  4 variables:
##  $ Name     : Factor w/ 10 levels "Aspen Colorado",..: 4 3 6 9 5 10 8 2 1 7
##  $ Latitude : num  28.4 33.8 22.1 37.8 36.1 ...
##  $ Longitude: num  -81.6 -117.9 -159.5 -122.5 -112.1 ...
##  $ Photo    : Factor w/ 9 levels "","<img src=\"https://c0.wallpaperflare.com/preview/855/549/100/united-states-yosemite-national-park-trees-forest."| __truncated__,..: 4 8 3 5 7 2 9 1 6 1

Sites
I wanted to include a website that you can click to learn more about that specific location.

Sites<-c("<a href='https://disneyworld.disney.go.com/'>Disney World!</a>",
                   "<a href='https://disneyland.disney.go.com/'>Disney Land!</a>",
                   "<a href='https://www.kauai.com/'>Kauai!!!</a>",
                 "<a href='https://www.goldengate.org/'>The Golden Gate Bridge!</a>",
                   "<a href='https://grandcanyon.com/'>The Grand Canyon!</a>",
                   "<a href='https://www.yosemite.com/'>The Yosemite National Park!</a>",
                   "<a href='https://zoo.sandiegozoo.org/'>San Diego!</a>",
                  "<a href='https://www.choosechicago.com/'>Chicago!</a>",
                "<a href='https://www.ski.com/aspen'>Aspen Colorado!</a>",
                "<a href='https://spacecenter.org/'>The Space Center in Houston!</a>")

Map
When designing my map, I wanted layer two types of basemaps. At first glance, the map used is the “GeoportailFrance.orthos” map. However, once you zoom all the way out, the map then turns to the “Earth at Night” map. Some of the locations are close to each other, so I included the addMarkers(clusterOptions = markerClusterOptions()) to cluster them. I also included a popup that reads, “I would like to visit…” and a link that will open the website I mentioned earlier.

top 10 places I want to visit!

library(leaflet) 
my_map <- leaflet() %>%
  addProviderTiles(providers$NASAGIBS.ViirsEarthAtNight2012) %>% 
  addProviderTiles(providers$GeoportailFrance.orthos) %>% 
  addMarkers(data = places, lng = ~Longitude, lat = ~Latitude, 
  popup = paste(sep = "<br/>","<h3>I would like to visit...</h3>", Sites, "<br/>",   places$Photo), 
  clusterOptions=markerClusterOptions())
my_map #Print the map