Learn R Programming

PROJ (version 0.4.5)

proj_trans: 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)

Value

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

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 i.e. 'source = "<some proj string"' can't be used in positional form)

z_

optional z coordinate vector

t_

optional t coordinate vector

Details

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.

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".

References

see the PROJ library documentation for details on the underlying functionality

Examples

Run this code
if (ok_proj6()) {
 proj_trans(cbind(147, -42), "+proj=laea", source = "OGC:CRS84")
 proj_trans(cbind(147, -42), z_ = -2, "+proj=laea", source = "OGC:CRS84")
 proj_trans(cbind(147, -42), z_ = -2, t_ = 1, "+proj=laea", source = "OGC:CRS84")
 }

Run the code above in your browser using DataLab