car2global: Conversions between cartesian and spheircal coordinate...

View source: R/car2global.R

car2globalR Documentation

Conversions between cartesian and spheircal coordinate systems.

Description

car2global Transforms points in a local coordinate system to the global coordinate system of Earth, given an origin in longitude, latitude and heave decimal values (DD). The output is in the range [-180,180] for longitude (East) and [-90,90] for latitude (North). Circular surface of the Earth is assumed in a neighbourhood around the 'origin'. car2pol Transformation from cartesian to polar coordinates returned as 'r', 'theta' and 'phi' as in Zwillinger (1985, pp. 297-298) and on http://mathworld.wolfram.com/SphericalCoordinates.html. car2sph Transformation from cartesian to spherical coordinates returned as 'r', 'theta' and 'phi' as in Zwillinger (1985, pp. 297-298) and on http://mathworld.wolfram.com/SphericalCoordinates.html. global2car Transforms points in the global coordinate system of Earth, given in longitude, latitude and heave decimal values (DD) in the range [-180,180] for longitude (East) and [-90,90] for latitude (North), to a cartesian coordinate system centered at a reference position, with y-axis pointing North and z-axis pointing vertically outwards from the surface of the Earth. Circular surface of the Earth is assumed in a neighbourhood around the 'origin'. pol2car Transformation from polar coordinates given as 'r' and 'theta', to cartesian coordinates. sph2car Transformation from spherical (polar) coordinates given as 'r', 'theta' and 'phi' as in Zwillinger (1985, pp. 297-298) and on http://mathworld.wolfram.com/SphericalCoordinates.html, to cartesian coordinates. radiusEarth Calculating the radius of Earth for the given latitude value(s). DD2DMS Simple function converting from decimal degrees to degrees, minutes and seconds. decdeg2degmin Converts decimal degrees to degrees and decimal minutes. decdeg2degminsec Converts decimal degrees to degrees, minutes and decimal seconds.

Usage

car2global(
  pos,
  origin = c(0, 0, 0),
  list.out = FALSE,
  format = c("dec", "min", "sec")
)

car2pol(x, y = NULL, perm = FALSE, nonneg = FALSE, list.out = FALSE)

car2sph(x, y = NULL, z = NULL, perm = FALSE, nonneg = FALSE, list.out = FALSE)

global2car(pos, origin = 1, list.out = FALSE)

pol2car(r, theta = NULL, perm = FALSE, list.out = FALSE)

sph2car(r, theta = NULL, phi = NULL, perm = FALSE, list.out = FALSE)

radiusEarth(lat, toaxis = FALSE)

DD2DMS(lon = NULL, lat = NULL, digits = 2)

decdeg2degmin(decdeg, digits = 3)

decdeg2degminsec(decdeg, digits = 3)

Arguments

pos

A list, matrix or vector of the points to be transformed.

origin

A vector of length 3 holding the origin of the cartesian coordinate system, given in longitude-latitude-heave decimal values (DD)).

list.out

Logical: TRUE if the output should be put in a list.

format

The return format, either dec = decimal degrees (default); min = degrees and decimal minutes; or sec = degrees, minutes and decimal seconds.

x

The points to transform, structured in one of the 4 following ways: (1) a vector of 'x' and/or 'y' and/or 'z'. (2) a matrix of columns representing 'x' and/or 'y' and/or 'z'. (3) a matrix of rows representing 'x' and/or 'y' and/or 'z', if which case perm needs to be TRUE. (4) a list of elements names "x", "y" and "z". 0 filled in for missing coordinates.

y

The y coordinates, optional if x is an appropriate structure.

perm

Logical: If TRUE the input points 'r' are given as a row matrix (see 'r').

nonneg

Logical: If TRUE negative values of 'theta' should be added 2*pi.

z

The z coordinates, optional if x is an appropriate structure.

r, theta, phi

Spherical/polar coordinates, given as for x, y and z.

lat

The vector of latitude values.

toaxis

Logical: If TRUE the radius to the axis of Earth is to be given.

lon

The vector of longitude values.

digits

The number of digits in the output of DD2DMS.

decdeg

Positions given as a two (or three in the case that heave is given) column matrix of longitude and latitude in decimal degrees.

Value

Position matrix in the requested format.


arnejohannesholmin/TSD documentation built on April 14, 2024, 5:29 a.m.