flightpathr

Tools to analyze aircraft and flight path data.
git clone https://git.eamoncaddigan.net/flightpathr.git
Log | Files | Refs | README | LICENSE

get3dCoords.R (700B)


      1 #' Checks for a \code{flighttrajectory} or \code{flightpath} object and returns
      2 #' it's position in a 3D matrix.
      3 #'
      4 #' @param coordObject An object that hopefully contains some coordinates.
      5 #' @return A nx3 coordinate matrix giving longitude/latitude/altitude.
      6 #'
      7 #' @details It'll be safer to access \code{flighttrajectory} and
      8 #'   \code{flightpath} objects' coordinates through this.
      9 get3dCoords <- function(coordObject) {
     10   if (!is.flighttrajectory(coordObject) & !is.flightpath(coordObject)) {
     11     stop("trajectory must be an instance of 'flighttrajectory' or 'flightpath'")
     12   }
     13 
     14   return(cbind(coordObject$longitude,
     15                coordObject$latitude,
     16                coordObject$altitude))
     17 }