proj_trans: Transform a set of coordinates with 'PROJ'

Description Usage Arguments Details Value References Examples

View source: R/proj_trans.R

Description

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

Usage

1
2
3
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

1
2
3
# 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")

Example output



PROJ documentation built on Oct. 23, 2020, 5:12 p.m.