Skip to contents

Lifecycle: experimental License: MIT

Tidy mapping verbs for biodiversity and spatial ecology.

tidymapr is the mapping companion to tidydiversity. tidydiversity estimates diversity, tidymapr puts it on a map, and the two work together the way dplyr and ggplot2 do. Every verb takes a data frame and returns a tibble, an sf table, a SpatRaster or a ggplot.

Sites and rasters

Sites as sf tables, raster values joined as columns, occurrence cleaning and GBIF records, vector and raster verbs, GDAL-backed I/O.

Publication maps

Study-site maps, Hill numbers on maps and stems over topography, with basemaps, scale bars and north arrows, saved at journal sizes.

Spatial ecology

Geographic and environmental distance decay, Moran’s I, dbMEM, spatial rarefaction, grain, mid-domain nulls and tidy species distribution models.

Installation

Install the development version from GitHub:

# install.packages("pak")
pak::pak("gitlab::jimmy.moses/tidymapr")

sf, terra and the other spatial packages are optional; install the ones you need with install.packages(c("sf", "terra")).

Example

png_ants (from tidydiversity) records ground ants at baits along the Mt Wilhelm elevational gradient in Papua New Guinea. Estimate richness with tidydiversity and map it with tidymapr in one pipeline:

library(tidydiversity)
library(tidymapr)
library(dplyr)

sites <- geo_example_sites("wilhelm")

div_estimate(png_ants, q = 0, nboot = 0, .by = season) |>
  left_join(sites, by = "site") |>
  filter(season == "dry") |>
  plot_geo(estimate, lon, lat, label = site, basemap = "coast")
#> Warning: No Natural Earth land data available; install rnaturalearth.
#> i Returning an empty land layer. Pass `coastline` or use a tile basemap.

Observed ant richness at each Mt Wilhelm site in the dry season

Site coordinates from geo_example_sites() are the published bait GPS of the Mt Wilhelm ant survey (png_ants_sites; Mottl, Moses and Klimes 2023, doi:10.5281/zenodo.8191946).

Study-site map

#> Warning: No Natural Earth land data available; install rnaturalearth.
#> i Returning an empty land layer. Pass `coastline` or use a tile basemap.

Study-site map with coast basemap, labels, scale bar and north arrow

Stems over topography

Stem map over hillshade and contours

Distance decay

Ant dissimilarity against great-circle distance by season

See the gallery for every map with its table and code.

Licence

MIT © 2026 Jimmy Moses