flightconflicts

Tools to analyze conflicts between aircraft.
git clone https://git.eamoncaddigan.net/flightconflicts.git
Log | Files | Refs | README | LICENSE

test_lonlatToXY.R (646B)


      1 library(flightconflicts)
      2 context("lonlatToXY")
      3 
      4 test_that("Returns sensible values", {
      5   kacyLon <- -74.5771667
      6   kacyLat <- 39.4575833
      7   # Find points 500 feet (152.4 m) from the origin
      8   compassPoints <- geosphere::destPoint(c(kacyLon, kacyLat),
      9                                         b = seq(0, 359, by = 45),
     10                                         d = 152.4)
     11   
     12   xyFeet <- lonlatToXY(compassPoints[, 1], compassPoints[, 2], kacyLon, kacyLat)
     13   
     14   expect_equal(xyFeet[1, ], c(0, 500), tolerance = 1e-4)
     15   expect_equal(xyFeet[3, ], c(500, 0), tolerance = 1e-4)
     16   expect_equal(sqrt(apply(xyFeet^2, 1, sum)), rep(500, 8), tolerance = 1e-4)
     17 })