Hello! This page is for showcasing the power of leaflet package in R . This document displays an interactive map of the major attractions in Singapore .
To start with - Sentosa Island .
We can have a look at the other important tourist locations in Singapore . This display helps in understanding how the various attractions are spread out .
df <- data.frame(lat = c(1.25011,1.28544, 1.318707, 1.282375, 1.4043, 1.4022, 1.4029 , 1.2868 , 1.3332, 1.2893 ) , long =c(103.83093 ,103.859590, 103.706442 , 103.864273 , 103.7930 , 103.7881 , 103.7917, 103.8545, 103.7362 , 103.8631) , popup = c("Sentosa Island", "Marina Bay Sands " , "Jurong Bird Park","Gardens By the Bay", "Singapore Zoo" , "Night Safari", "River Safari", "Merlion Park","Science Center", "Singapore Flyer") )
my_map <- leaflet() %>% addTiles() %>% addMarkers(data = df , lng = ~long , lat = ~lat , popup = df$popup)
my_map
Can we cluster the attractions ? Yes ! This will help the tourists in planning their travel and logistics .
my_map %>% leaflet() %>% addTiles() %>% addCircleMarkers(data = df , lng = ~long , lat = ~lat , radius = 5 , clusterOptions = markerClusterOptions())
We can make the map more expressive by adding Icons .
sgIcon <- leaflet::makeIcon(iconUrl = "http://img.freeflagicons.com/thumb/speech_bubble_icon/singapore/singapore_640.png", iconWidth = 41*225/240 , iconHeight = 41, iconAnchorX = 31*215/230/2, iconAnchorY = 16 )
my_map <- leaflet() %>% addTiles() %>% addMarkers(data = df , lng = ~long , lat = ~lat , popup = df$popup , icon = sgIcon)
my_map
This was just a glimpse of the capability of leaflet in R . By incorporating other functions in leaflet library we can provide more in depth visualization of the maps .
This is a very powerful tool , to analyse and display various events such as volcanic erruptions , earthquake prone segments , spread of infectious diseases /epidemics , availability of natural resources , social media analysis by location etc
Thank you!