This function is used to isolate other oce functions from changes to the rgdal::project() function in the rgdal package, which is used for calculations involved in both forward and inverse map projections.

oceProject(
xy,
proj,
inv = FALSE,
use_ob_tran = FALSE,
legacy = TRUE,
passNA = FALSE
)

## Arguments

xy, proj, inv, use_ob_tran, legacy As for the rgdal::project() function in the rgdal package. Logical value indicating whether to pass NA values into rgdal. The default is FALSE, meaning that any NA values are first converted to 0 before the calculation, and then converted to NA afterwards. Setting this to TRUE produces errors on the i386/windows platform, but it seems likely that a version of rgdal released after 1.3-9 may not have that error.

## Value

A two-column matrix, with first column holding either longitude or x, and second column holding either latitude or y.

## Details

Some highlights of the evolving relationship with rgdal are:

1. See https://github.com/dankelley/oce/issues/653#issuecomment-107040093 for the reason why oce switched from using rgdal::rawTransform(), to rgdal::project(), both functions provided by the rgdal package.

2. 2016 Apr: rgdal::project started returning named quantities

3. 2019 Feb: allowNAs_if_not_legacy was added in rgdal 1.3-9 to prevent an error on i386/windows. However, using this argument imposes a burden on users to update rgdal, so the approach taken here (by default, i.e. with passNA=FALSE) is to temporarily switch NA data to 0, and then switch back to NA after the calculation.