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.
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.
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).
Functions
| Family | Functions |
|---|---|
| Sites and occurrences |
geo_as_sf(), geo_drop_geometry(), geo_extract(), geo_clean(), geo_gbif(), as_sf(), as_spat_raster(), geo_as_features()
|
| Distances and spatial statistics |
geo_distance(), geo_decay(), geo_moran(), geo_mem(), geo_rarefy_spatial(), geo_grain(), geo_middomain()
|
| Forest plot stem maps |
stems_quadrat(), stems_habitat(), stems_neighbours(), stems_habitat_test()
|
| Maps |
plot_sites(), plot_geo(), plot_topo(), geo_basemap(), geo_save(), theme_tidymapr()
|
| Vector and raster |
geo_read(), geo_write(), geo_vector_*(), geo_raster_*(), geo_buffer(), geo_crop(), geo_union(), geo_area(), geo_join()
|
| Environmental layers |
geo_bioclim(), geo_worldclim(), geo_chelsa(), geo_elevation(), geo_gadm()
|
| Species distribution models |
sdm_fit(), sdm_predict(), sdm_evaluate(), plot_sdm()
|
| Example data |
png_ants_sites and geo_example_sites() (published Mt Wilhelm GPS); geo_example_stems(), geo_example_dem() and geo_example_censuses() (simulated, for tests only) |



