Skip to contents

GeoMag is an R package to estimate animal geolocation based on triaxis magnetic field measurements, including:

  • Magnetic calibration: Correct magnetic distortion using in-situ or in-vitro data.
  • Likelihood map estimation: Compute spatial likelihood maps using the World Magnetic Model (WMM), comparing observed and known intensity and inclination.
  • Interactive visualization: Explore raw and calibrated data, ellipsoid fits, and 3D scatterplots.

GeoMag is designed to work seamlessly with GeoPressureR, enabling high-resolution migratory track reconstruction using multi-sensor archival tags.


📦 Installation

To install the latest version from GitHub:

# install.packages("pak")
pak::pkg_install("Rafnuss/GeoMag")

🛠️ Example Usage

library(GeoMag)
library(GeoPressureR)

withr::with_dir(system.file("extdata", package = "GeoMag"), {
  # Create a GeoPressureR tag object (see GeoPressureR documentation)
  tag <- tag_create("14DM")

  # Label the tag
  tag <- tag_label(tag)
})

# Calibrate the tag's magnetic data
tag <- geomag_calib(tag)

# Interactive 3D plot of calibrated magnetic field
plot_mag(tag, type = "acceleration")
plot_mag(tag, type = "magnetic")
plot_mag(tag, type = "calib")

# Compute the spatial likelihood map for each stationary period
tag <- geomag_map(tag)

plot(tag, "map_magnetic")

📚 Citation

If you use GeoMag in your research, please cite:

Nussbaumer, R. (2025). GeoMag: Magnetic Field-Based Geolocation in R. https://github.com/Rafnuss/GeoMag

For citation information in R:

citation("GeoMag")