Skip to content
Prev 1154 / 29559 Next

distance calculation; meuse.grid

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