[R-sig-Geo] Outline of set of gridded points
Bjarke Christensen
Bjarke.Christensen at sydbank.dk
Mon Jul 28 16:44:42 CEST 2008
Hi,
I have a large number of SpatialPixelsDataFrame (or a grid with points that
can have either value 0 or 1). The pixels/points all cluster together, so
if there is a pixel at location (x, y), there is guaranteed to be a pixel
at an adjoining location also. So each SpatialPixelsDataFrame contains one
and only one contiguous cluster of pixels (points with value 1) and the
rest of the pixels have value 0. There may be holes in the clusters.
What I thought would be simple, but can't seem to program my way out of, is
to get a polygon demarking the outline of the cluster. I know I could use
chull, but it will draw a circle around a horseshoe-shaped cluster (quite
reasonably, as it is intended to make convex hulls). I would prefer a
polygon shaped like the outlines of a horseshoe, and I figure this should
be possible given that the data are gridded, so no need for a convexity
condition. Also, I'd like to trace the outlines only, not any holes in the
clusters. This must be a reasonably well known problem to geographers and
others, but as I said, I can't figure it out.
Can anyone help with ideas, pointers, code or anything?
Thanks very much in advance!
Bjarke.
More information about the R-sig-Geo
mailing list