Type: | Package |
Title: | Mapping Data for 'mapindia' Package |
Version: | 1.0.1 |
Maintainer: | Shubham Dutta <shubhamdutta26@gmail.com> |
Description: | Provides a container for data used by the 'mapindia' package. The data used by 'mapindia' has been extracted into this package so that the file size of the 'mapindia' package can be reduced considerably. The data in this package will be updated when latest data is available. |
License: | MIT + file LICENSE |
Encoding: | UTF-8 |
RoxygenNote: | 7.3.2 |
Imports: | dplyr, readr, rlang, sf, stringr, tidyr |
Suggests: | spelling, testthat (≥ 3.0.0) |
Depends: | R (≥ 2.10) |
Config/testthat/edition: | 3 |
URL: | https://github.com/shubhamdutta26/mapindiatools |
BugReports: | https://github.com/shubhamdutta26/mapindiatools/issues |
Language: | en-US |
NeedsCompilation: | no |
Packaged: | 2024-10-28 16:24:03 UTC; shubham |
Author: | Shubham Dutta |
Repository: | CRAN |
Date/Publication: | 2024-10-31 13:40:05 UTC |
Internal map creation tools
Description
'build_mapping_data()' creates the modified shapefiles used by the 'mapindia' package.
'ea_crs()' returns the World Geodetic System 1984 projection method (CRS) used by this package and 'mapindia'.
'compute_centroids()' computes the modified centroids for each state or district polygon using a center-of-mass technique on the largest polygon in the region.
Usage
build_mapping_data(type = c("states", "districts"), input_file, output_file)
ea_crs()
compute_centroids(polygons, iterations = 3, initial_width_step = 10)
Note
Using these functions externally is not recommended since they make certain undocumented assumptions that may not work with all inputs.
It is strongly recommend that the 'mapindia' package is used directly.
References
Gert (2017). “How to calculate polygon centroids in R (for non-contiguous shapes).” <https://gis.stackexchange.com/a/265475>.
Retrieve centroid labels
Description
Retrieve centroid labels
Usage
centroid_labels(regions = c("states", "districts"))
Arguments
regions |
The region breakdown for the map, can be one of
( |
Value
An 'sf' data frame of state or district centroid labels and positions
relative to the coordinates returned by the map_india
function.
Retrieve state and district codes
Description
Retrieve state and district codes
Usage
fetch_codes(regions = c("states", "state", "districts", "district"))
Arguments
regions |
The region breakdown for the map, can be one of
( |
Value
An data frame of codes of the desired regions
.
Examples
str(fetch_codes())
state_codes <- fetch_codes()
district_codes <- fetch_codes(regions = "districts")
Retrieve Indian mapping data
Description
Retrieve Indian mapping 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
( |
include |
The regions to include in the resulting map. If |
exclude |
he regions to exclude in the resulting map. If |
Value
An 'sf' data frame of indian map coordinates divided by the desired regions
.
Examples
str(map_india())
df <- map_india(regions = "districts")
include_states <- map_india(include = c("WB", "NL", "AP"))
exclude_states <- map_india(exclude = c("WB", "NL", "AP"))