Skip to contents

Retrieve India map data

Usage

map_india(
  regions = c("states", "state", "districts", "district"),
  include = c(),
  exclude = c()
)

Arguments

regions

The region breakdown for the map, can be one of ("states", "state", "districts", "district"). The default is "states".

include

The regions to include in the resulting map. If regions is "states"/"state", the value can be either a state name, abbreviation or code. For districts, the district codes must be provided as there can be multiple districts with the same name. If states are provided in the districts map, only districts in the included states will be returned.

exclude

The regions to exclude in the resulting map. If regions is "states"/"state", the value can be either a state name, abbreviation or code. For districts, the district codes must be provided as there can be multiple districts with the same name. The regions listed in the include parameter are applied first and the exclude regions are then removed from the resulting map. Any excluded regions not present in the included regions will be ignored.

Value

A data frame of India map coordinates divided by the desired regions.

See also

[mapindiatools::map_india()] of which this function is a wrapper for.

Examples

str(map_india())
#> sf [37 × 4] (S3: sf/tbl_df/tbl/data.frame)
#>  $ stname: chr [1:37] "Andaman & Nicobar" "Andhra Pradesh" "Arunachal Pradesh" "Assam" ...
#>  $ code11: chr [1:37] "35" "37" "12" "18" ...
#>  $ abbr  : chr [1:37] "AN" "AP" "AR" "AS" ...
#>  $ geom  :sfc_MULTIPOLYGON of length 37; first list element: List of 220
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 93.9 93.9 93.9 93.9 7.08 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:6, 1:2] 93.7 93.7 93.7 93.7 93.7 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:175, 1:2] 93.8 93.8 93.8 93.8 93.8 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 93.83 93.84 93.83 93.83 7.29 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:5, 1:2] 93.6 93.6 93.6 93.6 93.6 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:5, 1:2] 93.7 93.7 93.7 93.7 93.7 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:6, 1:2] 93.8 93.8 93.8 93.8 93.8 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:46, 1:2] 93.7 93.7 93.7 93.7 93.7 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 93.62 93.62 93.62 93.62 7.48 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 93.64 93.63 93.64 93.64 7.48 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 93.62 93.62 93.62 93.62 7.48 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:5, 1:2] 93.5 93.5 93.5 93.5 93.5 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:45, 1:2] 93.4 93.4 93.3 93.3 93.3 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:31, 1:2] 93.5 93.5 93.5 93.5 93.5 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 93.49 93.49 93.49 93.49 8.05 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 93.51 93.51 93.51 93.51 8.06 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 93.51 93.51 93.51 93.51 8.07 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 93.51 93.51 93.51 93.51 8.08 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 93.6 93.6 93.6 93.6 8.1 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 93.6 93.6 93.6 93.6 8.1 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 93.6 93.6 93.6 93.6 8.1 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 93.46 93.45 93.45 93.46 8.13 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 93.45 93.45 93.45 93.45 8.13 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 93.45 93.45 93.45 93.45 8.13 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 93.46 93.46 93.46 93.46 8.13 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 93.46 93.46 93.46 93.46 8.13 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 93.45 93.45 93.45 93.45 8.13 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 93.46 93.46 93.46 93.46 8.13 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:32, 1:2] 93.6 93.6 93.6 93.6 93.6 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 93.45 93.45 93.45 93.45 8.14 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 93.46 93.46 93.45 93.46 8.14 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 93.23 93.23 93.23 93.23 8.22 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:121, 1:2] 93.5 93.5 93.5 93.5 93.5 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:10, 1:2] 93.2 93.2 93.2 93.2 93.2 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:23, 1:2] 93.1 93.1 93.1 93.1 93.1 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 93.6 93.6 93.6 93.6 8.4 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:5, 1:2] 93.6 93.6 93.6 93.6 93.6 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 93.6 93.6 93.6 93.6 8.4 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:6, 1:2] 93 93 93 93 93 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:29, 1:2] 93.6 93.6 93.6 93.6 93.6 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 93.6 93.6 93.6 93.6 8.58 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:24, 1:2] 92.8 92.8 92.8 92.8 92.8 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:70, 1:2] 92.5 92.5 92.5 92.5 92.5 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 92.6 92.6 92.6 92.6 10.9 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:6, 1:2] 92.2 92.2 92.2 92.2 92.2 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:5, 1:2] 92.7 92.7 92.7 92.7 92.7 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 92.7 92.7 92.7 92.7 11.1 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:5, 1:2] 92.7 92.7 92.7 92.7 92.7 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:5, 1:2] 92.7 92.7 92.7 92.7 92.7 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:8, 1:2] 92.7 92.7 92.7 92.7 92.7 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:8, 1:2] 92.7 92.7 92.7 92.7 92.7 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 92.5 92.5 92.5 92.5 11.4 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 92.6 92.6 92.6 92.6 11.4 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 92.6 92.6 92.6 92.6 11.5 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 92.6 92.6 92.6 92.6 11.5 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:46, 1:2] 92.6 92.6 92.6 92.6 92.6 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:5, 1:2] 92.6 92.6 92.6 92.6 92.6 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:10, 1:2] 92.6 92.6 92.6 92.6 92.6 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 92.6 92.6 92.6 92.6 11.5 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:9, 1:2] 92.6 92.6 92.6 92.6 92.6 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:18, 1:2] 92.2 92.2 92.2 92.2 92.2 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 92.6 92.6 92.6 92.6 11.6 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 92.6 92.6 92.6 92.6 11.6 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:13, 1:2] 92.6 92.6 92.6 92.6 92.6 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 92.6 92.6 92.6 92.6 11.6 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:8, 1:2] 92.6 92.6 92.6 92.6 92.6 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 92.6 92.6 92.6 92.6 11.6 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:21, 1:2] 92.5 92.5 92.5 92.5 92.5 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 92.7 92.7 92.7 92.7 11.7 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:5, 1:2] 92.8 92.8 92.8 92.8 92.8 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 92.7 92.7 92.7 92.7 11.7 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:5, 1:2] 93.1 93.1 93.1 93.1 93.1 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:10, 1:2] 93 93 93 93 93 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:5, 1:2] 92.6 92.6 92.6 92.6 92.6 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 92.6 92.6 92.6 92.6 11.9 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:6, 1:2] 92.7 92.7 92.7 92.7 92.7 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 92.7 92.7 92.7 92.7 12 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:6, 1:2] 92.7 92.7 92.7 92.7 92.7 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:9, 1:2] 92.6 92.6 92.6 92.6 92.6 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 92.7 92.7 92.7 92.7 12 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:11, 1:2] 92.8 92.8 92.8 92.7 92.7 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 92.6 92.6 92.6 92.6 12 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 92.7 92.7 92.7 92.7 12 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 92.7 92.7 92.7 92.7 12 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 92.8 92.8 92.8 92.8 12 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:30, 1:2] 93 93 93 92.9 92.9 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 92.7 92.7 92.7 92.7 12.1 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:15, 1:2] 93 93 93 93 93 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:5, 1:2] 93 92.9 93 92.9 93 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 93.1 93 93.1 93.1 12.1 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 92.8 92.8 92.8 92.8 12.1 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 93.1 93.1 93.1 93.1 12.1 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:7, 1:2] 93.1 93.1 93.1 93.1 93.1 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:14, 1:2] 93 93 93 93 93 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:5, 1:2] 92.8 92.8 92.8 92.8 92.8 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:35, 1:2] 93 93 93 93 93 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 92.7 92.7 92.7 92.7 12.2 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:4, 1:2] 92.7 92.7 92.7 92.7 12.2 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:465, 1:2] 92.7 92.7 92.7 92.7 92.7 ...
#>   .. [list output truncated]
#>   ..- attr(*, "class")= chr [1:3] "XY" "MULTIPOLYGON" "sfg"
#>  - attr(*, "sf_column")= chr "geom"
#>  - attr(*, "agr")= Factor w/ 3 levels "constant","aggregate",..: NA NA NA
#>   ..- attr(*, "names")= chr [1:3] "stname" "code11" "abbr"

df <- map_india(regions = "districts")
states <- map_india(include = c("WB", "NCT", "AP"))