Skip to content
Prev 2408 / 29559 Next

spgpc package?

e.g.

# x is a gpc.poly object
as.Polygons.gpc.poly <- function(x, ID) {
	thisPolys <- lapply(get.pts(x), function(p) {
		Polygon(rbind(as.matrix(cbind(p$x,p$y)),c(p$x[1],p$y[1])),
			hole=p$hole)
	})
	Polygons(thisPolys, ID)
}

This works except if the gpc.poly is empty. `Polygons` fails if passed
an empty list().

Felix
On 8/9/07, Felix Andrews <felix at nfrac.org> wrote: