straightPath | R Documentation |
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
straightPath(gps, nSmall = 10, nLarge = 60, thresh = 10, plot = FALSE)
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 |
plot |
logical flag to plot result, |
the original dataframe gps
with an added logical column
straight
indicating which portions are approximately straight
Taiki Sakai taiki.sakai@noaa.gov
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.