Learn R Programming

PAMscapes (version 0.7.0)

readLocalAIS: Read AIS Data Near GPS Track

Description

Reads in AIS data downloaded from Marine Cadastre of ship tracks that come within a certain distance of a given GPS track. Also calculates the distance to the GPS track for each AIS point

Usage

readLocalAIS(gps, aisDir, distance = 10000, timeBuff = 0)

Value

a dataframe of AIS data, with additional columns related to distance to provided buoy GPS track

Arguments

gps

a dataframe with columns UTC, Latitude, and Longitude to get nearby AIS data for

aisDir

directory of AIS CSV files to read from

distance

distance in meters around the GPS track to read AIS data for

timeBuff

extra time (seconds) before and after the GPS points to read AIS data for. This can help create a better picture of ship activity surrounding the GPS

Author

Taiki Sakai taiki.sakai@noaa.gov

Examples

Run this code
gps <- data.frame(Latitude=c(33.2, 33.5,33.6),
                  Longitude=c(-118.1, -118.4, -119),
                  UTC=as.POSIXct(
                    c('2022-04-28 05:00:00',
                      '2022-04-28 10:00:00',
                      '2022-04-28 20:00:00'),
                    tz='UTC'))
ais <- readLocalAIS(gps, aisDir=system.file('extdata/ais', package='PAMscapes'), distance=20e3)
str(ais)

Run the code above in your browser using DataLab