Interactive epidemiological spot maps for India β no GIS software, no shapefiles, no setup.
AdarvMaps turns a spreadsheet of latitude and longitude from the field into a polished,
interactive HTML map. You can open the map in any browser, personalise it, and download
it as a PNG image or a PDF. AdarvMaps already has India's state and district
boundaries built in, so you don't have to search for shapefiles. This is the R package;
there is a matching Python package, adarvmaps.
Please ensure each row in your spreadsheet is one person or event, and that each row carries its location (latitude and longitude) in separate columns. You may also include an extra column that splits the data into case and control (a grouping variable), if you want to show both on the same map.
AdarvMaps turns your spreadsheet into an interactive map. It automatically places every row as a dot at its location, draws the correct state and district boundaries for you, and colours the two groups differently. It then generates a single, self-contained HTML file you can open in any browser to personalise your map, download as a PNG or PDF, or email to a colleague. You can also aggregate the dots to switch from a spot map to a dot-density map.
With AdarvMaps you can make:
| If this sounds like youβ¦ | Go to | |---|---| | π "I just want a map β I don't write code." | β Guide for non-coders | | π©βπ» "I use R and want the function reference." | β Guide for developers |
This guide is for anyone who wants to create a map but has never written any R code. The simplest way to run R without installing anything is Posit Cloud β free RStudio in your web browser.
Go to posit.cloud, sign up free, and click New Project β New RStudio Project. The box where you type is called the Console.
Paste these three lines into the Console and press Enter:
install.packages("remotes")
remotes::install_github("ADARV-Epi-hub/adarvmapsr")
library(adarvmapsr); adarvmapsr()
The first two lines install AdarvMaps (a couple of minutes the first time β that's normal); the third line starts the guided wizard.
AdarvMaps asks five questions. For each one it shows its own best guess in [brackets] β if the guess is right, just press Enter to accept it; otherwise, type the number of the correct choice.
1. Where is your data file?
- In Posit Cloud, first upload your spreadsheet with the Upload button in the Files
panel (bottom-right), then type its file name (CSV, Excel .xlsx / .xls, or TSV).
- AdarvMaps then prints a quick summary β how many rows and columns it found, each column name
with an example value, and the first few rows β so you can confirm the file was read
correctly.
- Please note: on Posit Cloud, your data is processed on Posit's servers. If you run
R on your own computer (RStudio Desktop), the data stays on your system.
2. Which column has the latitude?
- Latitude is the northβsouth number (for example, 28.61 for Delhi).
- AdarvMaps pre-selects the column it thinks is the latitude. If the guess is correct, press
Enter to accept; otherwise, check the summary above and type the number of the right column.
3. Which column has the longitude?
- Longitude is the eastβwest number (for example, 77.20 for Delhi).
- AdarvMaps pre-selects the column it thinks is the longitude. If the guess is correct, press
Enter to accept; otherwise, check the summary above and type the number of the right column.
- Remember: if the points later look misplaced, the most common mistake is that latitude
and longitude are swapped.
4. Which column is your grouping variable? - If your spreadsheet has a variable that splits the data into cases and controls, or affected and not affected, choose it here β we call this the grouping variable. - You can equally use this to show males and females, dead and alive, or positive and negative differently on the map. - If you don't want any split, choose the first option: My data is all cases (no control group).
5. Which value is the main group?
- AdarvMaps lists the values found in the grouping variable you chose in question 4.
- Tell it which value is the main group (the highlighted / clustered group). For example,
if you coded 1 = Case, 0 = Control or Yes = Case, No = Control, choose 1 or Yes.
- Every other value becomes the other group, shown with its own name from your data.
Once you've answered all five, AdarvMaps builds the map as an HTML file.
adarvmaps_200926.html) and tells you where it is.# install.packages("remotes")
remotes::install_github("ADARV-Epi-hub/adarvmapsr")
R >= 4.1. On Linux, sf needs libgdal-dev, libproj-dev, and libgeos-dev
(sf guide); Windows and macOS install a binary.
library(adarvmapsr)
adarvmapsr() # interactive wizard
adarvmapsr("my_data.csv", output = "map.html") # direct call, auto-detected columns
adarvmapsr(
data, # required: a CSV / Excel / TSV path, or a data.frame
state_shp = NULL, # custom state boundary (shapefile / GeoPackage)
district_shp = NULL, # custom district boundary
lat_col = NULL, # override column auto-detection
lon_col = NULL,
outcome_col = NULL, # the grouping column
case_value = NULL, # which value in outcome_col is the main group
case_label = NULL, # name for the main group (default: the data's own value)
control_label = NULL, # name for the other group (default: the data's own value)
all_cases = FALSE, # treat every row as a case (no second group)
count_cutoff = 2, # districts <= cutoff -> district-level zoom
margin_deg = 1.0, # boundary crop padding
cluster_color = "#E85252", # dot-density bubble colour
case_color = "#D55757", # main-group pin colour
control_color = "#7676E7", # other-group pin colour
output = NULL # path to save the HTML (returns the widget if NULL)
)
adarvmaps() is a friendly alias for adarvmapsr(). Run ?adarvmapsr in R for the full help.
| Argument | Description |
|---|---|
| data | Path to a CSV / Excel / TSV file, or a data.frame |
| lat_col, lon_col, outcome_col | Override column auto-detection |
| case_value | Value in outcome_col that is the main group |
| case_label, control_label | Names shown for the two groups (default: the data's values) |
| all_cases | TRUE treats every row as a case (no second group) |
| state_shp, district_shp | Use your own boundary shapefiles |
| cluster_color, case_color, control_color | Marker colours (hex) |
| output | Path to save the HTML (returns the widget if NULL) |
AdarvMaps auto-detects the columns β you don't have to rename anything. At a minimum it needs location, and optionally a grouping column:
| What AdarvMaps needs | Possible column names | How to provide it |
|---|---|---|
| Coordinates | lat, lon (or latitude, longitude) | Separate lat / lon columns |
| Grouping (optional) | outcome, status, case_control, case | A column with two values, e.g. case / control |
Example:
latitude,longitude,outcome
28.6,77.2,case
19.0,72.8,control
13.0,80.2,case
A single, self-contained HTML file you can open in any browser or share. Its sidebar lets anyone switch between Dot Density and Spot Pins, show one group or both, recolour and resize markers, toggle place-name labels, and export to PNG / PDF.
adarvmapsr is developed by the ADARV team:
The bundled India state and district boundaries are from the Survey of India, used under the Government Open Data License β India (GODL-India), which permits redistribution with attribution. The geometries are simplified for visual mapping and are not intended for precise measurement or official boundary determination.
The adarvmapsr package code is released under the MIT License β Β© ADARV.
(The bundled boundary data is under GODL-India; see Data source above.)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.