Skip to content

distance calculation; meuse.grid

2 messages · Adrian Baddeley, Roger Bivand

#
karl.sommer at dpi.vic.gov.au writes:
In package 'spatstat' there is a function distmap() 
designed for this purpose. 

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")

or
	  - 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
#
On Mon, 3 Jul 2006, Adrian Baddeley wrote:

            
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 

http://www.spatstat.org/

is always instructive!