1 Methods

1.1 Interactive mapping

While static maps in standard image formats are the most common type of visual output from geocomputation, interactive maps would useful for communicating ideas and geographic data visualisation quickly. In addition, user friendly maps would engage the audience to play with the maps themselves to serve their purpose. Also, interactive maps are also often the best way to present the findings of geocomputational research in a way that is accessible to users. Therefore, map making is a critical part of geocomputation and its emphasis not only on describing, but also changing the world though data visualization (Muenchow, 2021). This initiative is to show how to create an interactive map from scratch to demonstrate the features of three urban slums in Dhaka City.

1.2 Software

R Programming language has been used to create interactive maps with features. R is a free software which is used for statistical computing and graphics (R Core Team, 2021). Initially, static maps were the only type of maps that R could produce. Things advanced with the release of “sp” package and many techniques for map making have been developed since then. R Programming with appropriate map making packages enable anyone to make high-quality maps.

1.3 R setting

R is always pointed at a directory on our computer. We can find out which directory by running the getwd (get working directory) function without arguments. To change our working directory, we use setwd (set working directory) function and specify the path to the desired folder. We need to set working directory and path after cleaning up everything including your global environment of both r objects and loaded packages. Sometimes it is useful to Check r-version using print(version$version.string) function to be compatible for analysis to some extent.

rm(list=ls()) # Clean up everything 
# Set working directory 
setwd("F:/Maps") # setting path of working directory 
print(version$version.string) # Checking r-version

1.4 Required packages

As soon as local directory is set, we need to load required R packages such as tidyverse (Wickham, 2021), leaflet (Cheng, Karambelkar, et al., 2021), leafpop (Appelhans & Detsch, 2021), magrittr (Bache & Wickham, 2020), htmltools (Cheng, Sievert, et al., 2021), rjson (Couture-Beil, 2018), jsonlite (Ooms, 2020), reactable (Lin, 2020), htmlwidgets (Vaidyanathan et al., 2020), readr (Wickham & Hester, 2020), dplyr (Wickham et al., 2021), geospere (Robert, 2019), and table1 (Rich, 2021).

# Loading packages 
library("tidyverse")
library("leaflet")
library("htmltools")
library("leafpop") 
library("magrittr")
library("rjson")
library("jsonlite")
library("reactable")
library("htmlwidgets")
library("table1")
library("formatR")
library("geosphere")

1.4.1 Loading Data

The next step is to load primary data, stored at local directory, on health related facilities along with GPS coordinates of respective facilities collected by co-researchers from respective slums.

shyampur_slum <- readr::read_csv("shyampur_slum.csv")
kallayanpur_slum <- readr::read_csv("kallayanpur_slum.csv")
dholpur_slum <- readr::read_csv("dholpur_slum.csv")
description_keyterms_slum <- read_csv("description_keyterms_slum.csv")
comparison_slums <- readr::read_csv("comparison_slums.csv")

1.5 Data manipulation

1.5.1 Renaming columns

names(shyampur_slum) <- c("Facilities", "Details of facilities", "Longitude", "Latitude")
names(kallayanpur_slum) <- c("Facilities", "Details of facilities", "Longitude", "Latitude")
names(dholpur_slum) <- c("Facilities", "Details of facilities", "Longitude", "Latitude")

1.5.2 Sub-setting data: Kallayanpur

names(kallayanpur_slum) <- c("Facilities", "details", "lng", "lat")
hcf_kslums <- dplyr::filter(kallayanpur_slum, Facilities %in% "Health Care Facilities")
wcp_kslums <- dplyr::filter(kallayanpur_slum, Facilities %in% "Water collection point")
saf_kslums <- dplyr::filter(kallayanpur_slum, Facilities %in% "Sanitation") 
edi_kslums <- dplyr::filter(kallayanpur_slum, Facilities %in% "Educational institute")
rep_kslums <- dplyr::filter(kallayanpur_slum, Facilities %in% "Religious Place") 
gov_kslums <- dplyr::filter(kallayanpur_slum, Facilities %in% "Government Structure")
plg_kslums <- dplyr::filter(kallayanpur_slum, Facilities %in% "Playground")
cmc_kslums <- dplyr::filter(kallayanpur_slum, Facilities %in% "Community center") 
clb_kslums <- dplyr::filter(kallayanpur_slum, Facilities %in% "Club")
bzr_kslums <- dplyr::filter(kallayanpur_slum, Facilities %in% "Bazar")
wst_kslums <- dplyr::filter(kallayanpur_slum, Facilities %in% "Waste disposal")
fpa_kslums <- dplyr::filter(kallayanpur_slum, Facilities %in% "Fire prone area") 
usz_kslums <- dplyr::filter(kallayanpur_slum, Facilities %in% "Unsafe Zone")
wla_kslums <- dplyr::filter(kallayanpur_slum, Facilities %in% "Waterlogging area")

1.5.3 Sub-setting data: Dholpur

names(dholpur_slum) <- c("Facilities", "details", "lng", "lat")
hcf_dslums <- dplyr::filter(dholpur_slum, Facilities %in% "Health Care Facilities")
wcp_dslums <- dplyr::filter(dholpur_slum, Facilities %in% "Water collection point")
saf_dslums <- dplyr::filter(dholpur_slum, Facilities %in% "Sanitation") 
edi_dslums <- dplyr::filter(dholpur_slum, Facilities %in% "Educational institute")
rep_dslums <- dplyr::filter(dholpur_slum, Facilities %in% "Religious Place") 
gov_dslums <- dplyr::filter(dholpur_slum, Facilities %in% "Government Structure")
plg_dslums <- dplyr::filter(dholpur_slum, Facilities %in% "Playground")
cmc_dslums <- dplyr::filter(dholpur_slum, Facilities %in% "Community center") 
clb_dslums <- dplyr::filter(dholpur_slum, Facilities %in% "Club")
bzr_dslums <- dplyr::filter(dholpur_slum, Facilities %in% "Bazar")
wst_dslums <- dplyr::filter(dholpur_slum, Facilities %in% "Waste disposal")
epa_dslums <- dplyr::filter(dholpur_slum, Facilities %in% "Eviction prone area")
fpa_dslums <- dplyr::filter(dholpur_slum, Facilities %in% "Fire prone area") 
poe_dslums <- dplyr::filter(dholpur_slum, Facilities %in% "Place of entertainment")
usz_dslums <- dplyr::filter(dholpur_slum, Facilities %in% "Unsafe Zone")
wla_dslums <- dplyr::filter(dholpur_slum, Facilities %in% "Waterlogging area")

1.5.4 Sub-setting data: Shyampur

names(shyampur_slum) <- c("Facilities", "details", "lng", "lat")
hcf_sslums <- dplyr::filter(shyampur_slum, Facilities %in% "Health Care Facilities")
wcp_sslums <- dplyr::filter(shyampur_slum, Facilities %in% "Water collection point")
saf_sslums <- dplyr::filter(shyampur_slum, Facilities %in% "Sanitation") 
edi_sslums <- dplyr::filter(shyampur_slum, Facilities %in% "Educational institute")
rep_sslums <- dplyr::filter(shyampur_slum, Facilities %in% "Religious Place") 
wst_sslums <- dplyr::filter(shyampur_slum, Facilities %in% "Waste disposal")
epa_sslums <- dplyr::filter(shyampur_slum, Facilities %in% "Eviction prone area")
fpa_sslums <- dplyr::filter(shyampur_slum, Facilities %in% "Fire prone area") 
poe_sslums <- dplyr::filter(shyampur_slum, Facilities %in% "Place of entertainment")
usz_sslums <- dplyr::filter(shyampur_slum, Facilities %in% "Unsafe Zone")
wla_sslums <- dplyr::filter(shyampur_slum, Facilities %in% "Waterlogging area")
shyampur_slum_poe <- dplyr::filter(shyampur_slum, !Facilities %in% "Place of entertainment")

1.6 Knitting codes to create map

Now we can bring the three slums data together into a simple map using the leaflet package (Cheng, Karambelkar, et al., 2021; Dray, 2018). This package wraps up some functions from the Leaflet JavaScript library. First we’ll call the leaflet package from our library stored in local drive.

1.6.1 Creating boundary: Kallayanpur

outline_k <- kallayanpur_slum[chull(kallayanpur_slum$lng, kallayanpur_slum$lat),]

1.6.2 Creating boundary: Dholpur

outline_d <- dholpur_slum[chull(dholpur_slum$lng, dholpur_slum$lat),]

1.6.3 Creating boundary: Shyampur

outline_s <- shyampur_slum_poe[chull(shyampur_slum_poe$lng, shyampur_slum_poe$lat),]

1.6.4 Creating Leaflet map: Kallayanpur

kallayanpur_slum_map <- kallayanpur_slum %>%
  leaflet() %>% 
  addProviderTiles(providers$Esri.WorldImagery, group = "World Imagery") %>%
  addProviderTiles(providers$Stamen.TonerLite, group = "Toner Lite") %>%
  addProviderTiles(providers$OpenStreetMap, group = "Open SM") %>%
  addPolygons(data = outline_k, lng = outline_k$lng, lat = outline_k$lat, fill = FALSE, weight = 4, color = "red", opacity = 1, group = "Kallayanpur slum boundary") %>%
  addCircleMarkers(lng = hcf_kslums$lng, lat = hcf_kslums$lat, weight = 2, fillOpacity = 1, color = 'red', radius = 5, opacity = 1, group = "Pharmacy with(out) doctor", popup = hcf_kslums$details, options = popupOptions(keepInView = TRUE)) %>%
  addCircleMarkers(lng = wcp_kslums$lng, lat = wcp_kslums$lat, weight = 2, fillOpacity = 1, color = 'black', radius = 5, opacity = 1, group = "Drinking water collection point", popup = wcp_kslums$details, options = popupOptions(keepInView = TRUE)) %>%
  addCircleMarkers(lng = saf_kslums$lng, lat = saf_kslums$lat, weight = 2, fillOpacity = 1, color = 'green', radius = 5, opacity = 1,  group = "Toilet and washing point", popup = saf_kslums$details, options = popupOptions(keepInView = TRUE)) %>%
  addCircleMarkers(lng = edi_kslums$lng, lat = edi_kslums$lat, weight = 2, fillOpacity = 1, color = 'cyan', radius = 5, opacity = 1, group = "School or learning center", popup = edi_kslums$details, options = popupOptions(keepInView = TRUE)) %>%
  addCircleMarkers(lng = rep_kslums$lng, lat = rep_kslums$lat, weight =2, fillOpacity = 1, color = 'purple', radius = 5, opacity = 1, group = "Mosque or Temple", popup = rep_kslums$details, options = popupOptions(keepInView = TRUE)) %>%
  addCircleMarkers(lng = gov_kslums$lng, lat = gov_kslums$lat, weight =2, fillOpacity = 1, color = 'darkblue', radius = 5, opacity = 1, group = "Government structure", popup = gov_kslums$details, options = popupOptions(keepInView = TRUE)) %>%
  addCircleMarkers(lng = plg_kslums$lng, lat = plg_kslums$lat, weight =2, fillOpacity = 1, color = 'maroon', radius = 10, opacity = 1, group = "Playground", popup = plg_kslums$details, options = popupOptions(keepInView = TRUE)) %>%
  addCircleMarkers(lng = cmc_kslums$lng, lat = cmc_kslums$lat, weight =2, fillOpacity = 1, color = 'orange', radius = 10, opacity = 1, group = "Community center", popup = cmc_kslums$details, options = popupOptions(keepInView = TRUE)) %>%
  addCircleMarkers(lng = clb_kslums$lng, lat = clb_kslums$lat, weight =2, fillOpacity = 1, color = 'blueviolet', radius = 10, opacity = 1, group = "Community club", popup = clb_kslums$details, options = popupOptions(keepInView = TRUE)) %>%
  addCircleMarkers(lng = bzr_kslums$lng, lat = bzr_kslums$lat, weight =2, fillOpacity = 1, color = '#00CC66', radius = 5, opacity = 1, group = "Bazar", popup = bzr_kslums$details, options = popupOptions(keepInView = TRUE)) %>%
  addCircleMarkers(lng = wst_kslums$lng, lat = wst_kslums$lat, weight =2, fillOpacity = 1, color = 'darkred', radius = 5, opacity = 1, group = "Waste disposal point", popup = wst_kslums$details, options = popupOptions(keepInView = TRUE)) %>%
  addCircleMarkers(lng = fpa_kslums$lng, lat = fpa_kslums$lat, weight =2, fillOpacity = 1, color = '#0000FF', radius = 5, opacity = 1, group = "Fire prone area", popup = fpa_kslums$details, options = popupOptions(keepInView = TRUE)) %>%
  addCircleMarkers(lng = usz_kslums$lng, lat = usz_kslums$lat, weight =2, fillOpacity = 1, color = '#FF00CC', radius = 5, opacity = 1, group = "Unsafe zone", popup = usz_kslums$details, options = popupOptions(keepInView = TRUE)) %>%
  addCircleMarkers(lng = wla_kslums$lng, lat = wla_kslums$lat, weight =2, fillOpacity = 1, color = '#333033', radius = 5, opacity = 1, group = "Waterlogging area", popup = wla_kslums$details, options = popupOptions(keepInView = TRUE)) %>%
  #fitBounds(lng1 = min(kallayanpur_slum$lng), lat1 = min(kallayanpur_slum$lat), lng2 = max(kallayanpur_slum$lng), lat2 = max(kallayanpur_slum$lat)) %>%
  addMiniMap(toggleDisplay = TRUE, tiles = providers$OpenStreetMap) %>%
  #addGraticule(group = "Graticule", interval = 0.02, style = list(color = "#FF0000", weight = 1)) %>%
  addLayersControl(baseGroups = c("Open SM", "Toner Lite", "World Imagery"), options = layersControlOptions(collapsed = FALSE), 
                   overlayGroups = c("Kallayanpur slum boundary",
                                     #"Graticule",
                                     "Pharmacy with(out) doctor",
                                     "Drinking water collection point",
                                     "Toilet and washing point",
                                     "School or learning center",
                                     "Mosque or Temple",
                                     "Government structure",
                                     "Playground",
                                     "Community center",
                                     "Community club",
                                     "Community club",
                                     "Bazar", 
                                     "Waste disposal point",
                                     "Fire prone area",
                                     "Unsafe zone",
                                     "Waterlogging area")) %>%
  hideGroup(c(#"Pharmacy with(out) doctor",
    "Drinking water collection point",
    "Toilet and washing point",
    "School or learning center",
    "Mosque or Temple",
    "Government structure",
    "Playground",
    "Community center",
    "Community club",
    "Community club",
    "Bazar", 
    "Waste disposal point",
    "Fire prone area",
    "Unsafe zone",
    "Waterlogging area")) %>%
  addControl('<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">
             <img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png" /></a>',
             position = "bottomleft")%>%
  addMeasure(
    position = 'bottomleft',
    primaryLengthUnit = 'meters',
    primaryAreaUnit = 'sqmeters',
    activeColor = '#3D535D',
    completedColor = '#7D4479')

1.6.5 Creating Leaflet map: Dholpur

dholpur_slum_map <- dholpur_slum %>%
  leaflet() %>% 
  addProviderTiles(providers$Esri.WorldImagery, group = "World Imagery") %>%
  addProviderTiles(providers$Stamen.TonerLite, group = "Toner Lite") %>%
  addProviderTiles(providers$OpenStreetMap, group = "Open SM") %>%
  addPolygons(data = outline_d, lng = outline_d$lng, lat = outline_d$lat, fill = FALSE, weight = 4, color = "red", opacity = 1, group = "Dholpur slum boundary") %>%
  addCircleMarkers(lng = hcf_dslums$lng, lat = hcf_dslums$lat, weight = 2, fillOpacity = 1, color = 'red', radius = 5, opacity = 1, group = "Pharmacy with(out) doctor", popup = hcf_dslums$details, options = popupOptions(keepInView = TRUE)) %>%
  addCircleMarkers(lng = wcp_dslums$lng, lat = wcp_dslums$lat, weight = 2, fillOpacity = 1, color = 'black', radius = 5, opacity = 1, group = "Drinking water collection point", popup = wcp_dslums$details, options = popupOptions(keepInView = TRUE)) %>%
  addCircleMarkers(lng = saf_dslums$lng, lat = saf_dslums$lat, weight = 2, fillOpacity = 1, color = 'green', radius = 5, opacity = 1,  group = "Toilet and washing point", popup = saf_dslums$details, options = popupOptions(keepInView = TRUE)) %>%
  addCircleMarkers(lng = edi_dslums$lng, lat = edi_dslums$lat, weight = 2, fillOpacity = 1, color = 'cyan', radius = 5, opacity = 1, group = "School or learning center", popup = edi_dslums$details, options = popupOptions(keepInView = TRUE)) %>%
  addCircleMarkers(lng = rep_dslums$lng, lat = rep_dslums$lat, weight =2, fillOpacity = 1, color = 'purple', radius = 5, opacity = 1, group = "Mosque or Temple", popup = rep_dslums$details, options = popupOptions(keepInView = TRUE)) %>%
  addCircleMarkers(lng = gov_dslums$lng, lat = gov_dslums$lat, weight =2, fillOpacity = 1, color = 'darkblue', radius = 5, opacity = 1, group = "Government structure", popup = gov_dslums$details, options = popupOptions(keepInView = TRUE)) %>%
  addCircleMarkers(lng = plg_dslums$lng, lat = plg_dslums$lat, weight =2, fillOpacity = 1, color = 'maroon', radius = 10, opacity = 1, group = "Playground", popup = plg_dslums$details, options = popupOptions(keepInView = TRUE)) %>%
  addCircleMarkers(lng = cmc_dslums$lng, lat = cmc_dslums$lat, weight =2, fillOpacity = 1, color = 'orange', radius = 10, opacity = 1, group = "Community center", popup = cmc_dslums$details, options = popupOptions(keepInView = TRUE)) %>%
  addCircleMarkers(lng = clb_dslums$lng, lat = clb_dslums$lat, weight =2, fillOpacity = 1, color = 'blueviolet', radius = 5, opacity = 1, group = "Community club", popup = clb_dslums$details, options = popupOptions(keepInView = TRUE)) %>%
  addCircleMarkers(lng = bzr_dslums$lng, lat = bzr_dslums$lat, weight =2, fillOpacity = 1, color = '#00CC66', radius = 5, opacity = 1, group = "Bazar", popup = bzr_dslums$details, options = popupOptions(keepInView = TRUE)) %>%
  addCircleMarkers(lng = wst_dslums$lng, lat = wst_dslums$lat, weight =2, fillOpacity = 1, color = 'darkred', radius = 5, opacity = 1, group = "Waste disposal point", popup = wst_dslums$details, options = popupOptions(keepInView = TRUE)) %>%
  addCircleMarkers(lng = epa_dslums$lng, lat = epa_dslums$lat, weight =2, fillOpacity = 1, color = '#009999', radius = 5, opacity = 1, group = "Eviction prone area", popup = epa_dslums$details, options = popupOptions(keepInView = TRUE)) %>%
  addCircleMarkers(lng = fpa_dslums$lng, lat = fpa_dslums$lat, weight =2, fillOpacity = 1, color = '#0000FF', radius = 5, opacity = 1, group = "Fire prone area", popup = fpa_dslums$details, options = popupOptions(keepInView = TRUE)) %>%
  addCircleMarkers(lng = poe_dslums$lng, lat = poe_dslums$lat, weight =2, fillOpacity = 1, color = '#00FF00', radius = 5, opacity = 1, group = "Place of entertainment", popup = poe_dslums$details, options = popupOptions(keepInView = TRUE)) %>%
  addCircleMarkers(lng = usz_dslums$lng, lat = usz_dslums$lat, weight =2, fillOpacity = 1, color = '#FF00CC', radius = 5, opacity = 1, group = "Unsafe zone", popup = usz_dslums$details, options = popupOptions(keepInView = TRUE)) %>%
  addCircleMarkers(lng = wla_dslums$lng, lat = wla_dslums$lat, weight =2, fillOpacity = 1, color = '#333033', radius = 5, opacity = 1, group = "Waterlogging area", popup = wla_dslums$details, options = popupOptions(keepInView = TRUE)) %>%
  #fitBounds(lng1 = min(dholpur_slum$lng), lat1 = min(dholpur_slum$lat), lng2 = max(dholpur_slum$lng), lat2 = max(dholpur_slum$lat)) %>%
  addMiniMap(toggleDisplay = TRUE, tiles = providers$OpenStreetMap) %>%
  #addGraticule(group = "Graticule", interval = 0.02, style = list(color = "#FF0000", weight = 1)) %>%
  addLayersControl(baseGroups = c("Open SM", "Toner Lite", "World Imagery"), options = layersControlOptions(collapsed = FALSE), 
                   overlayGroups = c("Dholpur slum boundary",
                                     #"Graticule",
                                     "Pharmacy with(out) doctor",
                                     "Drinking water collection point",
                                     "Toilet and washing point",
                                     "School or learning center",
                                     "Mosque or Temple",
                                     "Government structure",
                                     "Playground",
                                     "Community center",
                                     "Community club",
                                     "Community club",
                                     "Bazar", 
                                     "Waste disposal point",
                                     "Eviction prone area",
                                     "Fire prone area",
                                     "Place of entertainment",
                                     "Unsafe zone",
                                     "Waterlogging area")) %>%
  hideGroup(c(#"Pharmacy with(out) doctor",
    "Drinking water collection point",
    "Toilet and washing point",
    "School or learning center",
    "Mosque or Temple",
    "Government structure",
    "Playground",
    "Community center",
    "Community club",
    "Community club",
    "Bazar", 
    "Waste disposal point",
    "Eviction prone area",
    "Fire prone area",
    "Place of entertainment",
    "Unsafe zone",
    "Waterlogging area")) %>%
  addControl('<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">
             <img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png" /></a>',
             position = "bottomleft")%>%
  addMeasure(
    position = 'bottomleft',
    primaryLengthUnit = 'meters',
    primaryAreaUnit = 'sqmeters',
    activeColor = '#3D535D',
    completedColor = '#7D4479')

1.6.6 Creating Leaflet map: Shyampur

shyampur_slum_map <- shyampur_slum %>%
  leaflet::leaflet() %>% 
  addProviderTiles(providers$Esri.WorldImagery, group = "World Imagery") %>%
  addProviderTiles(providers$Stamen.TonerLite, group = "Toner Lite") %>%
  addProviderTiles(providers$OpenStreetMap, group = "Open SM") %>%
  addPolygons(data = outline_s, lng = outline_s$lng, lat = outline_s$lat, fill = FALSE, 
              weight = 4, color = "blue", opacity = 1, group = "Dholpur slum boundary") %>%
  addCircleMarkers(lng = hcf_sslums$lng, lat = hcf_sslums$lat, weight = 2, 
                   fillOpacity = 1, color = 'red', radius = 5, opacity = 1, 
                   group = "Pharmacy with(out) doctor", popup = hcf_sslums$Facilities, 
                   options = popupOptions(keepInView = TRUE)) %>%
  addCircleMarkers(lng = wcp_sslums$lng, lat = wcp_sslums$lat, weight = 2, 
                   fillOpacity = 1, color = 'black', radius = 5, opacity = 1, 
                   group = "Drinking water collection point", popup = wcp_sslums$Facilities, 
                   options = popupOptions(keepInView = TRUE)) %>%
  addCircleMarkers(lng = saf_sslums$lng, lat = saf_sslums$lat, weight = 2, 
                   fillOpacity = 1,  color = 'green', radius = 5, opacity = 1,  
                   group = "Toilet and washing point", popup = saf_sslums$Facilities, 
                   options = popupOptions(keepInView = TRUE)) %>%
  addCircleMarkers(lng = edi_sslums$lng, lat = edi_sslums$lat, weight = 2, 
                   fillOpacity = 1,  color = 'cyan', radius = 5, opacity = 1, 
                   group = "School or learning center", popup = edi_sslums$Facilities, 
                   options = popupOptions(keepInView = TRUE)) %>%
  addCircleMarkers(lng = rep_sslums$lng, lat = rep_sslums$lat, weight =2, 
                   fillOpacity = 1, color = 'purple', radius = 5, opacity = 1, 
                   group = "Mosque or Temple", popup = rep_sslums$Facilities, 
                   options = popupOptions(keepInView = TRUE)) %>%
  addCircleMarkers(lng = wst_sslums$lng, lat = wst_sslums$lat, weight =2,  
                   fillOpacity = 1, color = 'deeppink', radius = 10, opacity = 1, 
                   group = "Waste disposal point", popup = wst_sslums$Facilities, 
                   options = popupOptions(keepInView = TRUE)) %>%
  addCircleMarkers(lng = epa_sslums$lng, lat = epa_sslums$lat, weight =2, 
                   fillOpacity = 1, color = '#009999', radius = 10, opacity = 1, 
                   group = "Eviction prone area", popup = epa_sslums$Facilities, 
                   options = popupOptions(keepInView = TRUE)) %>%
  addCircleMarkers(lng = fpa_sslums$lng, lat = fpa_sslums$lat, weight =2, 
                   fillOpacity = 1, color = '#0000FF', radius = 10, opacity = 1, 
                   group = "Fire prone area", popup = fpa_sslums$Facilities, 
                   options = popupOptions(keepInView = TRUE)) %>%
  addCircleMarkers(lng = poe_sslums$lng, lat = poe_sslums$lat, weight =2, 
                   fillOpacity = 1, color = '#00FF00', radius = 10, opacity = 1, 
                   group = "Place of entertainment", popup = poe_sslums$Facilities, 
                   options = popupOptions(keepInView = TRUE)) %>%
  addCircleMarkers(lng = usz_sslums$lng, lat = usz_sslums$lat, weight =2, 
                   fillOpacity = 1, color = '#FF00CC', radius = 5, opacity = 1, 
                   group = "Unsafe zone", popup = usz_sslums$Facilities, 
                   options = popupOptions(keepInView = TRUE)) %>%
  addCircleMarkers(lng = wla_sslums$lng, lat = wla_sslums$lat, weight =2, 
                   fillOpacity = 1, color = '#333033', radius = 5, opacity = 1, 
                   group = "Waterlogging area", popup = wla_sslums$Facilities, 
                   options = popupOptions(keepInView = TRUE)) %>%
  #fitBounds(lng1 = min(shyampur_slum$lng), lat1 = min(shyampur_slum$lat), 
  #          lng2 = max(shyampur_slum$lng), lat2 = max(shyampur_slum$lat)) %>%
  addMiniMap(toggleDisplay = TRUE, tiles = providers$OpenStreetMap) %>%
  #addGraticule(group = "Graticule", interval = 0.02, style = list(color = "#FF0000", weight = 1)) %>%
  addLayersControl(baseGroups = c("Open SM", "Toner Lite", "World Imagery"), 
                   options = layersControlOptions(collapsed = FALSE), 
                   overlayGroups = c("Dholpur slum boundary",
                                     #"Graticule",
                                     "Pharmacy with(out) doctor",
                                     "Drinking water collection point",
                                     "Toilet and washing point",
                                     "School or learning center",
                                     "Mosque or Temple",
                                     "Waste disposal point",
                                     "Eviction prone area",
                                     "Fire prone area",
                                     "Place of entertainment",
                                     "Unsafe zone",
                                     "Waterlogging area")) %>%
  
  hideGroup(c(#"Pharmacy with(out) doctor",
    "Drinking water collection point",
    "Toilet and washing point",
    "School or learning center",
    "Mosque or Temple",
    "Waste disposal point",
    "Eviction prone area",
    "Fire prone area",
    "Place of entertainment",
    "Unsafe zone",
    "Waterlogging area")) %>%
  addControl('<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">
             <img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png" /></a>',
             position = "bottomleft")%>%
  addMeasure(
    position = 'bottomleft',
    primaryLengthUnit = 'meters',
    primaryAreaUnit = 'sqmeters',
    activeColor = '#3D535D',
    completedColor = '#7D4479')

1.6.7 Combining features of three slums

shyampur <- readr::read_csv("shyampur_slum.csv")
kallayanpur <- readr::read_csv("kallayanpur_slum.csv")
dholpur <- readr::read_csv("dholpur_slum.csv")
shyampur$slum <- "Shyampur"
kallayanpur$slum <- "Kallayanpur"
dholpur$slum <- "Dholpur"
all_three_slum <- rbind(kallayanpur, dholpur, shyampur)
all_three_slum$slum <- factor(all_three_slum$slum, levels = c("Kallayanpur","Dholpur","Shyampur"))
all_three_slum <- dplyr::rename(all_three_slum, Facilities=landmark)
kallayanpur_slum_map

Figure 1: Different health related facilities in Kallayanpur Slum, DSCC, Dhaka City

dholpur_slum_map

Figure 2: Different health related facilities in Dholpur Slum, DSCC, Dhaka City

#
shyampur_slum_map

Figure 3: Different health related facilities in Shyampur Slum, DSCC, Dhaka City

References

Appelhans, T., & Detsch, F. (2021). Leafpop: Include tables, images and graphs in leaflet pop-ups [Manual]. https://github.com/r-spatial/leafpop
Bache, S. M., & Wickham, H. (2020). Magrittr: A forward-pipe operator for r [Manual]. https://CRAN.R-project.org/package=magrittr
Cheng, J., Karambelkar, B., & Xie, Y. (2021). Leaflet: Create interactive web maps with the JavaScript leaflet library [Manual]. https://rstudio.github.io/leaflet/
Cheng, J., Sievert, C., Chang, W., Xie, Y., & Allen, J. (2021). Htmltools: Tools for HTML [Manual]. https://github.com/rstudio/htmltools
Couture-Beil, A. (2018). Rjson: JSON for r [Manual]. https://CRAN.R-project.org/package=rjson
Dray, M. (2018). RPubs - Basic Leaflet maps in R. https://rpubs.com/mattdray/basic-leaflet-maps
Lin, G. (2020). Reactable: Interactive data tables based on react table [Manual]. https://CRAN.R-project.org/package=reactable
Muenchow, J., Jakub Nowosad. (2021). Chapter 9 Bridges to GIS software | Geocomputation with R. https://geocompr.robinlovelace.net/
Ooms, J. (2020). Jsonlite: A simple and robust JSON parser and generator for r [Manual]. https://CRAN.R-project.org/package=jsonlite
R Core Team, T. (2021). R: A language and environment for statistical computing. R Foundation for Statistical Computing [Manual]. https://www.R-project.org/
Rich, B. (2021). Table1: Tables of descriptive statistics in HTML [Manual]. https://github.com/benjaminrich/table1
Robert, J. H. (2019). Geosphere: Spherical Trigonometry [Manual]. https://CRAN.R-project.org/package=geosphere
Vaidyanathan, R., Xie, Y., Allaire, J., Cheng, J., Sievert, C., & Russell, K. (2020). Htmlwidgets: HTML widgets for r [Manual]. https://github.com/ramnathv/htmlwidgets
Wickham, H. (2021). Tidyverse: Easily install and load the tidyverse [Manual]. https://CRAN.R-project.org/package=tidyverse
Wickham, H., François, R., Henry, L., & Müller, K. (2021). Dplyr: A grammar of data manipulation [Manual]. https://CRAN.R-project.org/package=dplyr
Wickham, H., & Hester, J. (2020). Readr: Read rectangular text data [Manual]. https://CRAN.R-project.org/package=readr