addAIS {PAMscapes}R Documentation

Add AIS Data to Dataframe

Description

Adds matching AIS data downloaded from Marine Cadastre to a dataframe containing location information

Usage

addAIS(
  x,
  ais,
  interpType = c("all", "close", "none"),
  interpTime = 0,
  interpCols = NULL
)

Arguments

x

a dataframe with UTC, Latitude, and Longitude columns

ais

AIS data created using the readLocalAIS function

interpType

one of c('all', 'close', 'none'), the type of time interpolation to apply to x. Often the time scale of points in x is much longer than the points in ais, which can result in awkward looking AIS paths. 'all' will interpolate all points in x to a smaller timescale. 'close' will interpolate only time ranges in ais marked as inDist by readLocalAIS. 'none' will apply no interpolation

interpTime

time (seconds) between new UTC points. If 0 (default), no interpolation will be done

interpCols

names of any extra columns to interpolate (other than Latitude and Longitude)

Value

a dataframe with AIS data added, will contain more rows than x if ais has more than one vessel. If any interpolation is applied, any non-constant columns not specified to interpCols will be removed

Author(s)

Taiki Sakai taiki.sakai@noaa.gov

Examples

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)
gpsNoInterp <- addAIS(gps, ais, interpType='none')
str(gpsNoInterp)
gpsClose <- addAIS(gps, ais, interpType='close')
str(gpsClose)
gpsAllInterp <- addAIS(gps, ais, interpType='all')
str(gpsAllInterp)


[Package PAMscapes version 0.5.3 Index]