sphere.convert {Riemann} | R Documentation |
Convert between Cartesian Coordinates and Geographic Coordinates
Description
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.
Usage
sphere.geo2xyz(lat, lon)
sphere.xyz2geo(xyz)
Arguments
lat |
latitude (in decimal degrees). |
lon |
longitude (in decimal degrees). |
xyz |
a unit-norm vector in |
Value
transformed data.
Examples
## 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)
[Package Riemann version 0.1.4 Index]