[R-sig-Geo] Distances between points bounded by a polygon
Andrew Niccolai
andrew.niccolai at yale.edu
Tue Mar 20 20:08:00 CET 2007
Greetings spatial R users,
I have a question that is most likely straightforward but I am stuck on this
one!
I have a set of points that can be of the class "SpatialPoints" or of the
class "ppp" and they reside within a polygon of the class either
"SpatialPolygons" or "owin". I also have a set of pixels of class
"SpatialGridDataFrame" associated with the polygon. I would like to
calculate the distance between the points for every pixel in the
"SpatialGridDataFrame" that is bounded by the polygon/owin object.
Essentially the distmap function in spatstats package is what I am striving
for but it seems to produce a distance map that is bounded by a rectangular
"bounding box" of the extreme points. I have tried to set the as.mask
function but it gives me an error:
"
>V <- distmap(test7, as.mask(test8))
>Error in diff(w$yrange)/eps : non-numeric argument to binary operator
"
Any ideas or code that would enable me to "spread" that distance map
function across the entire polygon/owin or SpatialGridDF would be
tremendously appreciated.
Again, I would like to thank the the people that take the time to ask and
those that answer these types of questions on the list serve!!
Cheers
Andrew Niccolai
Doctoral Candidate
Yale University
More information about the R-sig-Geo
mailing list