[R-sig-Geo] distance map from raster class

Adrian Baddeley adrian at maths.uwa.edu.au
Thu Apr 16 13:00:52 CEST 2009


Milton writes:

> I have binary images, and would like to generate a distance map from the ONEs.

> I tryed to use spatstat to solve this but may be it not work.

distmap has a method for 'owin' objects, but not for 'im' objects. 
The quick solution is to convert your image to an owin object using as.owin() and then apply distmap.

In your example, type
     my.distmap <- distmap(as.owin(my.image))

If you want the opposite, use complement.owin

regards
Adrian Baddeley



More information about the R-sig-Geo mailing list