sphere.convert | R Documentation |
In geospatial data analysis, it is common to consider locations on the Earth as
data. These locations, usually provided by latitude and longitude, are not directly
applicable for spherical data analysis. We provide two functions - sphere.geo2xyz
and sphere.xyz2geo
-
that convert geographic coordinates in longitude/latitude into a unit-norm vector on \mathcal{S}^2, and vice versa.
As a convention, latitude and longitude are represented as decimal degrees.
sphere.geo2xyz(lat, lon) sphere.xyz2geo(xyz)
lat |
latitude (in decimal degrees). |
lon |
longitude (in decimal degrees). |
xyz |
a unit-norm vector in \mathcal{S}^{2}. |
transformed data.
## EXAMPLE DATA WITH POPULATED US CITIES data(cities) ## SELECT ALBUQUERQUE geo = cities$coord[1,] xyz = cities$cartesian[1,] ## CHECK TWO INPUT TYPES AND THEIR CONVERSIONS sphere.geo2xyz(geo[1], geo[2]) sphere.xyz2geo(xyz)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.