Learn R Programming

mosaic (version 0.4-1)

xyz2latlon: Convert back and forth between latitude/longitude and XYZ-space

Description

Convert back and forth between latitude/longitude and XYZ-space

Usage

xyz2latlon(x, y, z)

latlon2xyz(latitude, longitude)

Arguments

x,y,z
numeric vectors
latitude,longitude
vectors of latitude and longitude values

Value

  • a matrix each row of which describes the latitudes and longitudes

    a matrix each row of which contains the x, y, and z coordinates of a point on a unit sphere

See Also

deg2rad, googleMap, and rgeo.

Examples

Run this code
xyz2latlon(1, 1, 1)     # point may be on sphere of any radius
xyz2latlon(0, 0, 0)     # this produces a NaN for latitude
latlon2xyz(45, 45)

Run the code above in your browser using DataLab