[R-sig-Geo] distance calculation; meuse.grid

Roger Bivand Roger.Bivand at nhh.no
Mon Jul 3 11:11:39 CEST 2006

On Mon, 3 Jul 2006 karl.sommer at dpi.vic.gov.au wrote:

> Hello
> I was wondering if there is a way in "R" or "sp" to calculate shortest
> distance from a given object such as a river, similar to the data example
> "meuse.grid"  under the gstat package. I was wondering how the "dist"
> variable in the "meuse.grid"  file was orignially calculated?  I would like
> to perform a similar calculation as shortest distance for each point in a
> field (1m x 1m grid) from an irrigation channel for which I have generated
> a shape file.  Or is such an operation better performed in a GIS
> environment?

You can use spDistsN1() in sp to measure distances from many points to one 
point, including Great Circle distances. This will not be good enough for 
distances between other kinds of objects, so a GIS is the obvious choice 
for that. My guess for the origins of the meuse.grid distances is 
PCRaster, a raster GIS. If your irrigation channel has a lot of detail, 
you could use spDistsN1 in a loop between the grid of points and each 
point representing the channel, but it would be very messy, a GIS is 
designed to do this.


> Regards
> Karl
> _______________________________________________
> 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