R: Wrapper to rgdal::project()

oceProject {oce} | R Documentation

## Wrapper to rgdal::project()

### Description

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

### Usage

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

### Arguments

`xy` | As for the `project` function in the rgdal package.
`proj` | "
`inv` | "
`use_ob_tran` | "
`legacy` | "
`passNA` | 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.

### 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 `rawTransform`, to `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.

### Value

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

[Package oce version 1.1-1 Index]