R: Transform a set of coordinates with 'PROJ'

proj_trans {PROJ} | R Documentation

## Transform a set of coordinates with 'PROJ'

### Description

A raw interface to 'proj_trans' in 'PROJ => 6', if it is available.

### Usage

    proj_trans(x, target, ..., source = NULL, z_ = NULL, t_ = NULL)

    proj_trans_generic(x, target, ..., source = NULL, z_ = 0, t_ = 0)

### Arguments

`x` | input coordinates (x,y, list or matrix see `z_` and `t_`)
`target` | projection for output coordinates
`...` | ignored
`source` | projection of input coordinates (must be named)
`z_` | optional z coordinate vector
`t_` | optional t coordinate vector

### Details

'proj_trans_generic()' and 'proj_trans()' have the same arguments, but differ in the default values of `z_` and `t_`, `0` or `NULL`. 'proj_trans_generic()' always returns a list for 4 elements, 'proj_trans()' will return 2 or 4 depending on the input.

'proj_trans_generic()' is a misnomer in that 'proj_trans' is the function from the PROJ library that is now used.

Input 'x' is assumed to be 2-columns of "x", then "y" coordinates. If "z" or "t" is required pass these in as named vectors with "z_" and "t_". For simplifying reasons `z_` and `t_` must always match the length of `x` `y`. Both default to 0, and are automatically recycled to the number of rows in `x` so it's pretty flexible.

Values that are detected out of bounds by library PROJ are allowed, we return `Inf` in this case, rather than the error "tolerance condition error".

### Value

list of transformed coordinates, with 4-elements `x_`, `y_`, `z_`, `t_`

### References

see the PROJ library documentation for details on the underlying functionality

### Examples

    # proj_trans(cbind(147, -42), "+proj=laea", source = "epsg:4326")
     #proj_trans(cbind(147, -42), z_ = -2, "+proj=laea", source = "epsg:4326")
     #proj_trans(cbind(147, -42), z_ = -2, t_ = 1, "+proj=laea", source = "epsg:4326")

[Package PROJ version 0.4.0 Index]