Leaflet is a popular open source Javascript tool used to create interactive mapping. Large websites such as The New York Times, The Washington Post, Flikr, and many others use leaflet to integrate maps.
# Calling standard Leaflet map.
library(leaflet)
m <- leaflet() %>%
addTiles() %>%
addMarkers(lng=-80.16083, lat=24.98475)
m
# Adding "popups" to our points to bring up information
m <- leaflet() %>%
addTiles() %>%
addMarkers(lng=-80.16083, lat=24.98475, popup="Pickles Reef")%>%
addMarkers(lng=-81.7435, lat=24.473867, popup="Marker 32") %>%
addMarkers(lng=-080.4363000, lat=24.9822000, popup="CRF Nursery"
)
m
HTML can be used to create the format for pop ups
# using paste() to create an HTML layout for more detailed popups
library(htmltools)
pop1 <- paste(sep = "<br/>",
"<b><a>Pickles Reef </a></b>",
"Lattitude: 24.98475",
"Longitude: -80.16083",
"Specimans planted: A. cervicornis "
)
pop2 <- paste(sep = "<br/>",
"<b><a>Marker 32 </a></b>",
"Lattitude: 24.473867",
"Longitude: -81.7435",
"Specimans planted: A. cervicornis "
)
pop3 <- paste(sep = "<br/>",
"<b><a>CRF Nursery </a></b>",
"Lattitude: 24.9822000",
"Longitude: -080.4363000",
"Speciman Collection Date: Circa 1996"
)
pop4 <- paste(sep = "<br/>",
"<b><a> Plantation Key Patch Reef </a></b>",
"Lattitude: 24.9518833°",
"Longitude: -080.4363000",
"Speciman Collection Date: Circa 1996"
)
m <- leaflet() %>%
addTiles() %>%
addMarkers(lng=-80.16083, lat=24.98475, popup=pop1,label = htmlEscape(pop1))%>%
addMarkers(lng=-81.7435, lat=24.473867, popup=pop2)%>%
addMarkers(lng=-080.4363000,lat=24.9822000,popup=pop3)%>%
addMarkers(lng=-080.4916167, lat= 24.9518833, popup=pop4)
m