[R-sig-Geo] Thanks to all: Distances in geoR package

Roger Bivand Roger.Bivand at nhh.no
Fri Jun 17 17:01:55 CEST 2005


On Fri, 17 Jun 2005, Tim Keitt wrote:

> Perhaps we could get it added into R core. The spherical-earth GC
> distance function is only a few lines of code.
> 

(Just a note to say that this question turned out to have more general 
interest, and Martin Maechler has taken it up on R-core. It's about how C 
functions in one package can call C functions in another, which means 
having both the header files and the DLL/so file findable. If this is 
resolved cross-platform and for others to benefit from, we gain too. The 
RGtk package family has examples of how this can work).

Roger

> THK
> 
> On Fri, 2005-06-17 at 15:22 +0200, Roger Bivand wrote:
> > On Fri, 17 Jun 2005, Paulo Justiniano Ribeiro Jr wrote:
> > 
> > > A few words more on this.
> > > 
> > > My feeling is that the best way to handle this is with coordinate
> > > trasformation (for instance for UTM) and then backtransform
> > > at the  end if required.
> > > 
> > 
> > And a couple more ...
> > 
> > Which way to go depends on the relative scale of the phenomena of 
> > interest. For up to hundreds of km, the distortions introduced by 
> > projecting to UTM or other suitable projections are small. But at 
> > continental scales, working with Great Circle distances for building 
> > distance matrices is a much better choice, not depending on the origin of 
> > the projection. 
> > 
> > I've had C code in spdep for some time to do GC (an if() on a flag passed
> > through .Call to choose between the R built-in pythag() or the GC
> > distance). I've put a copy in the spgwr package, but multiple copies means
> > maintenance problems. The rdist.earth() function in fields is at the R
> > level - the nice comment on the help page does hold: "Surprisingly this
> > [is] all done efficiently in S".
> > 
> > I'd like to expose the GC function in the sp package, but have not yet
> > looked at how contributed packages can share functions (and header files)
> > at the C level - the header file is the real issue, I think. Would there
> > be interest in doing this? The GC function as it is does not have an R
> > wrapper, because in spdep, most of the distances are thrown away
> > immediately as being beyond threshold.
> > 
> > Feedback, please?
> > 
> > Roger
> > 
> > > There were a few messages along these lines and I will take the
> > > opportunity to mention that there is a package under development (aRT)
> > > which intends to provide this and other functionalities typical from GIS
> > > systems via Terralib
> > > The package page is: http://www.est.ufpr.br/aRT
> > > 
> > > Still changing rapidly but already some functionalities are already
> > > working.
> > > There is a package vignette and a few exemples in the tests directory.
> > > This package adheres the the "sp" classes andin newer versions also allows
> > > "proj4".
> > > 
> > > Best
> > > P.J.
> > > 
> > > 
> > > 
> > > On Fri, 17 Jun 2005, giovanna jona lasinio wrote:
> > > 
> > > > Dear all, thanks for the many suggestions, I'll try and let you know
> > > > what worked best. Package fields works well in computing variogram's
> > > > cloud with lon-lat coordinates (returns by default distances in miles)
> > > > and usually I use a loess-built curve to get a nice-looking version of
> > > > the variogram. However I wasn't able to use the "vgram" function's
> > > > output in order to obtain a "variofit" estimated model. What would be
> > > > extremely usefull, in my opinion, is to allow "variog" to accept a
> > > > distance matrix as input, in this way no coordinate transformation would
> > > > be needed. I'm not yet good enough at programming in R to find a good
> > > > solution myself :-) but if I find a solution I'll let you know....
> > > >
> > > > Best
> > > > Giovanna Jona Lasinio
> > > >
> > > > _______________________________________________
> > > > R-sig-Geo mailing list
> > > > R-sig-Geo at stat.math.ethz.ch
> > > > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> > > >
> > > >
> > > 
> > > Paulo Justiniano Ribeiro Jr
> > > LEG (Laboratório de Estatística e Geoinformação)
> > > Departamento de Estatística
> > > Universidade Federal do Paraná
> > > Caixa Postal 19.081
> > > CEP 81.531-990
> > > Curitiba, PR  -  Brasil
> > > Tel: (+55) 41 3361 3573
> > > Fax: (+55) 41 3361 3141
> > > e-mail: paulojus at est.ufpr.br
> > > http://www.est.ufpr.br/~paulojus
> > > 
> > > _______________________________________________
> > > R-sig-Geo mailing list
> > > R-sig-Geo at stat.math.ethz.ch
> > > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> > > 
> > 
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no




More information about the R-sig-Geo mailing list