addAISSummary {PAMscapes}R Documentation

Add AIS Data Summary to Dataframe

Description

Adds a summary of matching AIS data for nearby vessels to a data. Information added includes number of vessels, distance to nearby vessels, and average speed of nearby vessels

Usage

addAISSummary(x, ais, distance = 10000)

Arguments

x

a dataframe with UTC, Latitude, and Longitude columns

ais

AIS data created using the readLocalAIS function. Can also be a character listing the directory of AIS

distance

distance (meters) within locations in x to mark as "nearby"

Value

a dataframe with AIS summary data added. Will contain new columns

nShips

the number of ships within "distance" at this time

meanDist

average distance of nearby ships, NA if none

meanSOG

average speed over ground of nearby ships, NA if none

closeDist

distance of the closest ship, NA if none

closeSOG

speed over ground of closest ship, NA if none

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, system.file('extdata/ais', package='PAMscapes'))
aisSummary <- addAISSummary(gps, ais)
str(aisSummary)


[Package PAMscapes version 0.5.3 Index]