###library

library(bangladesh)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
# Load base maps
country <- get_map("country")
division <- get_map("division")
district <- get_map("district")
upazila <- get_map("upazila")

1. Division map: All Divisions

# 1. Division map: All Divisions
plot(division[1], main = "1. Bangladesh Division Map: All Divisions")

2. own division map: Mymensingh

# 2. own division map: Mymensingh
mymensingh_division <- division %>%
  filter(Division == "Mymensingh")
plot(mymensingh_division[1], main = "2. own Division Map: Mymensingh", col = "lightgreen")

# 3. District map: All Districts

# 3. District map: All Districts
plot(district[1], main = "3. Bangladesh District Map: All Districts")

# 4. own district map: Mymensingh District

# 4. own district map: Mymensingh District
mymensingh_district_only <- district %>%
  filter(District == "Mymensingh")
plot(mymensingh_district_only[1], main = "4.own  District Map: Mymensingh District", col = "yellowgreen")

5. Upazila map: All Upazilas

# 5. Upazila map: All Upazilas
plot(upazila[1], main = "5. Bangladesh Upazila Map: All Upazilas")

6. three upazila maps (Muktagacha, Bhaluka, Trishal)

# 6.  three upazila maps (Muktagacha, Bhaluka, Trishal)
selected_upazilas <- c("Muktagacha", "Bhaluka", "Trishal")

# Filter the three selected upazilas from the 'upazila' object
three_upazilas <- upazila %>%
  filter(Upazila %in% selected_upazilas)

# Plot the three upazilas
# Using plot(object) without [1] ensures the polygon features are plotted correctly.
plot(three_upazilas, 
     main = "6. (Three Upazila Maps: Muktagacha, Bhaluka, Trishal")