Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

RMtrafo

Transformation of coordinate systems


Description

The functions transform a coordinate system into another coordinate system. Currently, essentially only from the earth system to cartesian.

RMtrafo is the internal basic function that also allows to reduce vectors to their norm.

Usage

RMtrafo(phi, new)
RFearth2cartesian(coord, units=NULL, system="cartesian", grid=FALSE)
RFearth2dist(coord, units=NULL, system="cartesian", grid=FALSE, ...)

Arguments

new

integer or character. One of the values RC_ISOTROPIC, RC_SPACEISOTROPIC, RC_CARTESIAN_COORD, RC_GNOMONIC_PROJ, RC_ORTHOGRAPHIC_PROJ

or the corresponding RC_ISONAMES.

Note that RMtrafo only allows for integer values.

Default: RC_CARTESIAN_COORD.

phi

optional submodel

coord

matrix or vector of earth coordinates

units

"km" or "miles"; if not given and RFoptions()$general$units != "", the latter is used. Otherwise "km".

system

integer or character. The coordinate system, e.g. "cartesian", "gnomonic" or "orthographic".

grid

logical. Whether the given coordinates are considered to be on a grid given by c(start, step, length).

Default: FALSE.

...

the optional arguments of dist

Details

The functions transform between different coordinate systems.

Value

The function RMtrafo returns a matrix, in general. For fixed column, the results, applied to each row of the matrix, are returned.

The function RFearth2cartesian returns a matrix in one-to-one correspondence with coord assuming that the earth is an ellipsoid.

The function RFearth2dist calculates distances, cf. dist, assuming that the earth is an ellipsoid.

Note

Important options are units and coordinate_system, see RFoptions.

Note also that the zenit must be given explicitly for projection onto a plane. See the examples below.

Author(s)

References

For calculating the earth coordinates as ellipsoid:

See Also

Examples

data(weather)
(coord <- weather[1:5, 3:4])

(z <- RFfctn(RMtrafo(new=RC_CARTESIAN_COORD), coord))
(z1 <- RFearth2cartesian(coord)) ## equals z
z1 - z ## 0, i.e., z1 and t(z) are the same
dist(z)


(d <- RFearth2dist(coord)) 
d - dist(z) ## 0, i.e., d and dist(z) are the same


## projection onto planes
RFoptions(zenit=c(-122,   47))
RFearth2cartesian(coord, system="gnomonic")
RFearth2cartesian(coord, system="orthographic")

RandomFields

Simulation and Analysis of Random Fields

v3.3.10
GPL (>= 3)
Authors
Martin Schlather [aut, cre], Alexander Malinowski [aut], Marco Oesting [aut], Daphne Boecker [aut], Kirstin Strokorb [aut], Sebastian Engelke [aut], Johannes Martini [aut], Felix Ballani [aut], Olga Moreva [aut], Jonas Auel[ctr], Peter Menck [ctr], Sebastian Gross [ctr], Ulrike Ober [ctb], Paulo Ribeiro [ctb], Brian D. Ripley [ctb], Richard Singleton [ctb], Ben Pfaff [ctb], R Core Team [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.