commit 11ce3f53c8d8ec34d320f03666def253f43575ff
parent cb9d56b4a86f246e0dd6dd624f38c6fe8e60be72
Author: eamoncaddigan <eamon.caddigan@gmail.com>
Date: Thu, 19 May 2016 16:15:40 -0400
Decided to make geosphere a requirement.
Diffstat:
2 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/DESCRIPTION b/DESCRIPTION
@@ -10,5 +10,5 @@ Depends:
License: MIT
LazyData: true
RoxygenNote: 5.0.1
-Suggests: flightpathr,
- geosphere
+Imports: geosphere
+Suggests: flightpathr
diff --git a/R/createTrajectory.R b/R/createTrajectory.R
@@ -67,15 +67,11 @@ createTrajectory <- function(longitude, latitude, altitude = 0, timestamp = NULL
# Use geosphere to find the distance between points and use the timestamps to
# calculate groundspeed if not specified.
if (is.null(groundspeed)) {
- if (requireNamespace("geosphere", quietly = TRUE)) {
- distNM <- geosphere::distCosine(coords[1:(nCoord-1), ],
- coords[2:nCoord, ],
- r = 3444)
- groundspeed <- distNM / timestamp[1:(nCoord-1)] * 3600
- groundspeed <- c(groundspeed, groundspeed[nCoord-1])
- } else {
- stop("Package \"geosphere\" must be installed or groundspeed must be specified")
- }
+ distNM <- geosphere::distCosine(coords[1:(nCoord-1), ],
+ coords[2:nCoord, ],
+ r = 3444)
+ groundspeed <- distNM / timestamp[1:(nCoord-1)] * 3600
+ groundspeed <- c(groundspeed, groundspeed[nCoord-1])
} else{
checkLength(groundspeed)
}