GeoThinneR is an R package designed for efficient spatial thinning of species occurrence records and other geospatial point data. It integrates three primary thinning methods (distance-based, grid-based, and precision-based thinning) into a single package, eliminating the need to switch between multiple tools. GeoThinneR implements algorithms based on kd-tree structures for nearest-neighbor searches, significantly improving performance and scalability for large datasets. Additionally, the package provides custom functionalities useful for species distribution modeling (SDM), such as thinning by group (e.g., multiple species), retaining an exact number of points, and prioritizing records based on user-defined variables. These features make GeoThinneR a valuable tool for handling large-scale occurrence datasets.
GeoThinneR has been developed as an alternative tool for spatial thinning to mitigate the effects of sampling bias in SDM. Various approaches exist to address sampling bias, each suited to different scenarios. Below are some references discussing methods for bias correction and spatial thinning:
You can install GeoThinneR from CRAN with:
install.packages("GeoThinneR")
To install the development version from GitHub, use:
# install.packages("devtools")
::install_github("jmestret/GeoThinneR") devtools
Using GeoThinneR is simple. The main function,
thin_points()
, applies spatial thinning using a
user-specified method and thinning constraint.
library(GeoThinneR)
# Distance-based thinning (minimum separation of 10 km)
thin_points(data, method = "distance", thin_dist = 10)
# Grid-based thinning (grid resolution of 0.1 degrees)
thin_points(data, method = "grid", resolution = 0.1)
# Precision-based thinning (rounding coordinates to 1 decimal place)
thin_points(data, method = "precision", precision = 1)
For detailed documentation, guides, and usage examples, please visit the official package documentation.
We welcome contributions! If you have suggestions for improvements or new features, please open an issue or submit a pull request on our GitHub repository.
The GeoThinneR paper is currently in preparation. Meanwhile, you can cite the package using:
Mestre-Tomás J (2025). GeoThinneR: Efficient Spatial Thinning of Species Occurrences. R package version 2.0.0, https://github.com/jmestret/GeoThinneR