Introduction

A World Heritage site is a landmark or area which is selected by the United Nations Educational, Scientific and Cultural Organization (UNESCO) as having cultural, historical, scientific or other form of significance, and is legally protected by international treaties. The sites are judged important to the collective interests of humanity. According to UNESCO: “What makes the concept of World Heritage exceptional is its universal application. World Heritage sites belong to all the peoples of the world, irrespective of the territory on which they are located.” For more information:

In this project, we will plot the location of different World Heritage sites present in India using leaflet, a widely used open source JavaScript library used to build web mapping applications. The dataset can be downloaded from the following link: datahub

library(readxl)
library(leaflet)

# load the dataset
data <- read_xls('whc-sites-2018.xls')
data <- data[c('name_en', 'short_description_en', 'longitude', 'latitude', 'category', 'states_name_en')]

# extract location of only Indian sites
data <- subset(data, states_name_en == 'India') 

summary(data)
##    name_en          short_description_en   longitude        latitude    
##  Length:36          Length:36            Min.   :72.10   Min.   : 8.53  
##  Class :character   Class :character     1st Qu.:75.57   1st Qu.:18.96  
##  Mode  :character   Mode  :character     Median :77.38   Median :23.67  
##                                          Mean   :78.65   Mean   :22.49  
##                                          3rd Qu.:79.73   3rd Qu.:27.11  
##                                          Max.   :93.42   Max.   :31.83  
##    category         states_name_en    
##  Length:36          Length:36         
##  Class :character   Class :character  
##  Mode  :character   Mode  :character  
##                                       
##                                       
## 
content <- paste(sep = "<br/>",
                 paste('<b style="color:grey;">',data$name_en,'</b>'),
                 data$short_description_en,
                 paste('Category: ', '<i style="color:blue;">', data$category, '</i>'))

data["information"] <- content

# making groups
natural <- subset(data, category == 'Natural')
cultural <- subset(data, category == 'Cultural')
mixed <- subset(data, category == 'Mixed')


my_map <- leaflet(width = 800, height = 700) %>%
  addTiles() %>%
  setView(lng = 78.9629, lat = 20.5937, zoom = 5) %>%
  
  # Add two tiles
  addProviderTiles("Esri.WorldImagery", group="background 1") %>%
  addTiles(options = providerTileOptions(noWrap = TRUE), group="background 2") %>%
 
  # Add 3 marker groups
  addCircleMarkers(data = natural,
                   lng = ~longitude,
                   lat = ~latitude,
                   radius = 8,
                   color = "black",
                   fillColor = "green",
                   stroke = TRUE,
                   fillOpacity = 0.9,
                   group = "Natural",
                   popup = ~information) %>%
  addCircleMarkers(data = cultural,
                   lng = ~longitude,
                   lat = ~latitude,
                   radius = 8,
                   color = "black",
                   fillColor = "red",
                   stroke = TRUE,
                   fillOpacity = 0.9,
                   group = "Cultural",
                   popup = ~information) %>%
  addCircleMarkers(data = mixed,
                   lng = ~longitude,
                   lat = ~latitude,
                   radius = 8,
                   color = "black",
                   fillColor = "orange",
                   stroke = TRUE,
                   fillOpacity = 0.9,
                   group = "Mixed",
                   popup = ~information) %>%
  
  # Add the control widget
  addLayersControl(overlayGroups = c("Natural", "Cultural", "Mixed"),
                   baseGroups = c("background 1","background 2"),
                   options = layersControlOptions(collapsed = FALSE))
my_map