[R-sig-Geo] distance calculation; meuse.grid
Roger.Bivand at nhh.no
Mon Jul 3 15:40:54 CEST 2006
On Mon, 3 Jul 2006, Adrian Baddeley wrote:
> karl.sommer at dpi.vic.gov.au writes:
> > 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.
> In package 'spatstat' there is a function distmap()
> designed for this purpose.
Excellent! I'll add suitable functions to the sourceforge repository
spspatstat package to interface sp classes to this solution, probably
within a month. The as.mask() arguments can be derived from a SpatialGrid
GridTopology slot, so this will help more people. Visiting
is always instructive!
> The object (the river) may be either
> - a list of line segments (line segment pattern object, class "psp")
> - a list of x,y coordinate points (point pattern object, class "ppp")
> - a binary pixel image (window object, class "owin", type "mask")
> The return value is a pixel image; the brightness value of each pixel
> gives the shortest distance from that pixel to the target object.
> You can display the pixel image, extract the values at chosen locations
> using the subset operator "[ ]", or extract the entire pixel array
> using "as.matrix".
> Adrian Baddeley
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
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