straightPath: Mark Straight Path Segments in GPS Track

View source: R/straightPath.R

straightPathR Documentation

Mark Straight Path Segments in GPS Track

Description

This function attempts to mark portions of a GPS track where a ship is traveling in a straight line by comparing the recent average heading with a longer term average heading. If these are different, then the ship should be turning. Note this currently does not take in to account time, only number of points

Usage

straightPath(gps, nSmall = 10, nLarge = 60, thresh = 10, plot = FALSE)

Arguments

gps

gps data with columns Longitude, Latitude, and UTC (POSIX format). Usually this has been read in from a Pamguard database, in which case columns Heading and Speed will also be used.

nSmall

number of points to average to get ship's current heading

nLarge

number of points to average to get ship's longer trend heading

thresh

the amount which nSmall and nBig should differ by to call this a turn

plot

logical flag to plot result, gps must also have columns Latitude and Longitude

Value

the original dataframe gps with an added logical column straight indicating which portions are approximately straight

Author(s)

Taiki Sakai taiki.sakai@noaa.gov

Examples


gps <- data.frame(Latitude = c(32, 32.1, 32.2, 32.2, 32.2),
                  Longitude = c(-110, -110.1, -110.2, -110.3, -110.4),
                  UTC = as.POSIXct(c('2000-01-01 00:00:00', '2000-01-01 00:00:10',
                                     '2000-01-01 00:00:20', '2000-01-01 00:00:30',
                                     '2000-01-01 00:00:40')),
                  Heading = c(320, 320, 270, 270, 270),
                  Speed = c(.8, .8, .5, .5, .5))

straightPath(gps, nSmall=1, nLarge=2)

straightPath(gps, nSmall=1, nLarge=4)


PAMmisc documentation built on June 22, 2024, 9:37 a.m.