[R] code to convert 3D geographical coordinates to Cartesian?

David Winsemius dwinsemius at comcast.net
Mon Dec 31 09:36:08 CET 2012


On Dec 30, 2012, at 8:14 PM, Tom Roche wrote:

>
> https://stat.ethz.ch/pipermail/r-help/2012-December/332658.html
>>> Is there packaged code to convert geographical coordinates (e.g.,
>>> longitude, latitude, elevation) to Cartesian coordinates in 3-space?
> ...
>>> Net: the task seems straightforward enough, but there's certainly
>>> scope for error, so I'd prefer to use tested, well-used code if
>>> available.
>
> https://stat.ethz.ch/pipermail/r-help/2012-December/332666.html
>> Have you checked the spatial stats task view on CRAN?
>
>> http://cran.r-project.org/web/views/Spatial.html
>
> I have, and can't believe that functionality this fundamental is not
> API.

You have a very different notion of what would be considered core  
capabilities in a statistics program than I have.

> But I have looked at several packages and am not seeing it. I
> suspect that either it's so low-level that it's just not exposed as  
> API,
> or just that there is API but I'm not seeing it in the package docs
> ("hidden in plain sight"). Hence I ask
>
>>> Am I missing something?

How did you search?

install.packages("sos")
require(sos)
 > findFn("latitude longitude cartesian")

Two different packages with functions that sound as though they might  
be useful.

sphereplot::sph2car  "Transforms 3D spherical coordinates to cartesian  
coordinates"

GEOmap::Lll2xyz "List Lat-Lon to cartesian XYZ"


-- 
David.

David Winsemius, MD
Alameda, CA, USA




More information about the R-help mailing list