View source: R/sl.xyz2lonlat.R
sl.xyz2lonlat | R Documentation |
Covert one or more points from x-y-z (unit sphere) to longitude-latitude coordinates.
sl.xyz2lonlat(xyzvec=NULL, x=NULL, y=NULL, y=NULL)
xyzvec |
a vector of length 3 with the x, y, and z coordinates of a single point, or |
x |
a vector or array with the x coordinates of one or more points, or |
y |
a vector or array with the y coordinates of one or more points, or |
z |
a vector or array with the z coordinates of one or more points, or |
If the point(s) is/are not located on the unit sphere, they are accordingly shortened/elongated.
If xyzvec=NULL
, a list with elements lon
and lat
, each of which are vectors or arrays of the same size as x,y,z
with the latitudes and longitudes of the points. Otherwise, a single vector of length 2 with the longitude and latitude of the single point.
Helge Goessling
sl.lonlat2xyz
sl.xyz2lonlat(xyzvec=c(0,1/sqrt(2),1/sqrt(2)))
## Should return:
## [1] 90 45
sl.xyz2lonlat(x=1:5,y=seq(-2,2),z=c(2.543,1.3676,0.432,1.4,-5.22))
## Should return:
## $lon
## [1] -63.43495 -26.56505 0.00000 14.03624 21.80141
##
## $lat
## [1] 48.674731 31.450344 8.194263 18.754912 -44.107748
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.