GPStable: Format GPS data

Description Usage Arguments Details Value Author(s) References Examples

View source: R/GPStable.R

Description

Takes DateTime, Latitude and Longitude in decimal degrees and converts Latitude and Longitude into radians and calculates bearing and distance between consecutive locations

Usage

1

Arguments

rawdata

data frame with DateTime, or Date and Time separately, in same format as deadreckoning data, Latitude and Longitude in decimal degrees. Must use those column labels.

Details

Data must be provided in decimal degrees (e.g. 162.546). Longitude values west of the prime meridian are 0 to -180. Latitude values south of the equator are 0 to -90. DateTime must be in the same format as output of DeadReckoning function or separated as Date and Time that can be pasted together to create the same format as output of the Deadreckoning function. Distance is calculated using the Spherical Law of Cosines (see references).

Value

Returns a data frame with columns DateTime, Latitude(Decimal Degrees), Longitude(Decimal Degrees), LatRad(Radians), LongRad(Radians), BearingRad, BearingDeg, DistanceKm. BearingRad and BearingDeg are the bearing calculated from point x to point x+1. DistanceKm is the distance between point x and point x-1.

Author(s)

Brian Battaile

References

https://www.movable-type.co.uk/scripts/latlong.html

Examples

1
2
3
4
data(gpsdata02)
head(gpsdata02)
gpsformat<-GPStable(gpsdata02)
head(gpsformat)

Example output

Loading required package: fields
Loading required package: spam
Loading required package: dotCall64
Loading required package: grid
Spam version 2.5-1 (2019-12-12) is loaded.
Type 'help( Spam)' or 'demo( spam)' for a short introduction 
and overview of this package.
Help for individual functions is also obtained by adding the
suffix '.spam' to the function name, e.g. 'help( chol.spam)'.

Attaching package:spamThe following objects are masked frompackage:base:

    backsolve, forwardsolve

See https://github.com/NCAR/Fields for
 an extensive vignette, other supplements and source code 
Loading required package: RColorBrewer
              DateTime Latitude Longitude
1 21-Jul-2009 09:30:00 53.93111 -168.0349
2 22-Jul-2009 01:23:39 53.93306 -168.0346
3 22-Jul-2009 01:45:09 53.94334 -168.0436
4 22-Jul-2009 02:07:13 53.94441 -168.0607
5 22-Jul-2009 02:36:46 53.94956 -168.1028
6 22-Jul-2009 02:56:31 53.94757 -168.1132
              DateTime Latitude Longitude    LatRad   LongRad  BearingRad
1 21-Jul-2009 09:30:00 53.93111 -168.0349 0.9412755 -2.932762  0.09180597
2 22-Jul-2009 01:23:39 53.93306 -168.0346 0.9413094 -2.932757 -0.47828271
3 22-Jul-2009 01:45:09 53.94334 -168.0436 0.9414889 -2.932915 -1.46424471
4 22-Jul-2009 02:07:13 53.94441 -168.0607 0.9415076 -2.933213 -1.36558342
5 22-Jul-2009 02:36:46 53.94956 -168.1028 0.9415975 -2.933948 -1.88773642
6 22-Jul-2009 02:56:31 53.94757 -168.1132 0.9415627 -2.934128 -1.47080487
  BearingDeg DistanceKm
1   5.260095  0.0000000
2 332.596419  0.2170772
3 276.104958  1.2876086
4 281.757833  1.1241930
5 251.840670  2.8147816
6 275.729088  0.7123356

TrackReconstruction documentation built on Dec. 11, 2021, 10:07 a.m.