title: “Interactive Map with Leaflet (R Markdown)” author: “Your Name” date: “September 28, 2025” output: html_document: toc: false number_sections: false self_contained: true # good for RPubs & GitHub Pages theme: flatly —
This page was generated on September 28, 2025 and includes an interactive map built with the leaflet R package.
The map below shows a few major Indian cities with popups, clustered markers, and an optional heat of circle markers just for fun. Use the layer control (top-right) to switch basemaps and toggle overlays.
# Sample points (feel free to personalize!)
cities <- tibble::tribble(
~city, ~lat, ~lng, ~group,
"Mumbai", 19.0760, 72.8777, "West",
"Delhi", 28.6139, 77.2090, "North",
"Bengaluru", 12.9716, 77.5946, "South",
"Kolkata", 22.5726, 88.3639, "East",
"Chennai", 13.0827, 80.2707, "South",
"Hyderabad", 17.3850, 78.4867, "South",
"Pune", 18.5204, 73.8567, "West",
"Ahmedabad", 23.0225, 72.5714, "West"
) %>%
mutate(popup = paste0(
"<b>", city, "</b><br/>",
"Group: ", group, "<br/>",
"Lat/Lng: ", round(lat, 4), ", ", round(lng, 4)
))
# A simple polygon (approx bounding box around India for decoration)
poly_latlng <- list(
rbind(c(8.0, 68.0), c(8.0, 98.0), c(37.0, 98.0), c(37.0, 68.0), c(8.0, 68.0))
)
## R version 4.0.0 (2020-04-24)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 20.04 LTS
##
## Matrix products: default
## BLAS/LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.8.so
##
## locale:
## [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
## [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
## [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=C
## [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
## [9] LC_ADDRESS=C LC_TELEPHONE=C
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] dplyr_1.0.0 leaflet_2.0.4.1
##
## loaded via a namespace (and not attached):
## [1] knitr_1.35 magrittr_2.0.1 tidyselect_1.1.0
## [4] R6_2.4.1 rlang_0.4.11 stringr_1.4.0
## [7] tools_4.0.0 xfun_0.26 jquerylib_0.1.4
## [10] htmltools_0.5.0 crosstalk_1.1.0.1 ellipsis_0.3.1
## [13] yaml_2.2.1 digest_0.6.28 tibble_3.0.1
## [16] lifecycle_1.0.1 crayon_1.3.4 purrr_0.3.4
## [19] htmlwidgets_1.5.4 vctrs_0.3.1 glue_1.4.1
## [22] evaluate_0.14 rmarkdown_2.11 stringi_1.4.6
## [25] compiler_4.0.0 pillar_1.4.4 leaflet.providers_1.9.0
## [28] generics_0.0.2 jsonlite_1.6.1 pkgconfig_2.0.3