Documentation
A complete step-by-step workflow is available in the Articles/User guide.
📖 List of functions, example datasets and their documentation: Reference.
Overview
AISanalyze is an R package providing a fast and reproducible workflow for preprocessing Automatic Identification System (AIS) vessel tracking data for environmental and ecological research. It streamlines common preprocessing tasks through a small set of user-friendly functions, including vessel trajectory reconstruction, GPS correction, interpolation, and the extraction of vessel positions around target locations or time periods.
The package emphasizes computational efficiency and reproducibility, allowing large AIS datasets to be prepared for downstream analyses in seconds to minutes. Its main functionalities include:
- estimating vessel travel distance, time, and speed;
- correcting GPS errors and delays;
- identifying AIS base stations and aircraft;
- interpolating vessel positions;
- extracting vessel positions around target locations and times;
- retrieving vessel characteristics (ship type, length, width, draught, IMO number, and vessel name).
Installation
The stable version of AISanalyze is available on CRAN and can be installed and loaded with:
install.packages("AISanalyze")
library(AISanalyze)Main functions
| Function | Description |
|---|---|
AIStravel() |
Estimate travelled distance, time and speed |
AISidentify_stations_aircraft() |
Identify AIS stations and aircraft |
AIScorrect_speed() |
Correct GPS errors and delays |
AISinterpolate() |
Interpolate vessel positions |
AISextract() |
Extract vessels around target locations |
AISinfos() |
Estimate vessel characteristics |
Example
data("ais")
data("point_to_extract")
## define the Unix time (seconds since 1970-01-01)
ais$timestamp <- as.numeric(lubridate::ymd_hms(ais$datetime))
point_to_extract$timestamp <- as.numeric(lubridate::ymd_hm(point_to_extract$datetime))
## correct, interpolate and extract vessel positions:
results <- ais |>
AIStravel(nb_cores = 4, crs = 3035) |>
AISidentify_stations_aircraft(crs = 3035) |>
dplyr::filter(!station & !high_speed) |>
AIScorrect_speed(nb_cores = 4, crs = 3035) |> # correct speed
AISinterpolate(type_interpolation = "maximum_gap_seconds",
maximum_gap_seconds = 60,
nb_cores = 4, crs = 3035) |>
AISextract(data = point_to_extract,
search_into_radius_m = 10000,
nb_cores = 4, crs = 3035)
# The AIS data are now joined to your dataset!Performance
Total execution time to complete the example workflow with 100 points to extract and 4 CPU cores:
| AIS dataset size | 100,000 points | 1,000,000 points | 2,500,000 points |
|---|---|---|---|
| Time | 14 sec | 68 sec | 146 sec |
Citation
If you use AISanalyze, please cite:
Pigeault R., Ruser A., RamÃrez-MartÃnez N.C., Geelhoed S.C.V., Haelters J., Nachtsheim D.A., Schaffeld T., Sveegaard S., Siebert U., Gilles A. (2024). Maritime traffic alters distribution of the harbour porpoise in the North Sea. Marine Pollution Bulletin. 208: 116925. DOI: 10.1016/j.marpolbul.2024.116925
citation("AISanalyze")Contributing
Contributions are welcome! Whether you would like to report a bug, suggest a new feature, or contribute code or documentation, please read our contributing guidelines guide to get started.