Have you checked the spatial stats task view on CRAN?

http://cran.r-project.org/web/views/Spatial.html

-- Bert

On Sun, Dec 30, 2012 at 6:49 PM, Tom Roche <Tom_Roche@pobox.com> wrote:

>
> Is there packaged code to convert geographical coordinates (e.g.,
> longitude, latitude, elevation) to Cartesian coordinates in 3-space?
> I can see how to do this using
>
> 1. a spherical-to-Cartesian conversion like pracma::sph2cart(tpr)
>
> http://cran.r-project.org/web/packages/pracma/
>
> 2. a geographical-to-spherical conversion. This seems to involve (in
>    roughly increasing order of difficulty or error-prone-ness)
>
> * converting longitude (units=°) to an azimuthal angle (units=rad)
>
> * converting latitude (units=°) to a polar angle (aka inclination)
>   (units=rad)
>
> * converting elevation (usually, distance above mean sea level) to
>   radial distance (i.e., distance from earth center). Ideally this
>   should be done using a user-chosen coordinate reference system and
>   ellipsoid/geoid (i.e., PROJ.4-style), hence my hope that some package
>   (of which I'm currently unaware) has already coded this The Right Way.
>   For now, for the atmospheric model with which I need to work, I
>   believe I can just assume a spherical earth with r=6370 km, and just
>   add that to the elevation.
>
> 3. composition of the two (e.g., sph2cart(geo2sph(lat.lon.elev))),
>    noting that package=pracma uses the mathematics convention that
>    azimuth=Θ and polar angle=φ (vs the reverse physics convention).
>
> 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.
> Am I missing something?
>
> TIA, Tom Roche <Tom_Roche@pobox.com>
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

	[[alternative HTML version deleted]]


