Dear All


I need to handly some circular-shaped polygons on R. First I adapted the
code from Barry Rowlingson to create a function that create the list of X-Y
points which create a circle with a specified radii. After that I need to
save each circle as shapefile with writeOGR. My last task is to identify the
region that are overlaped by three circles.

I tryed to convert my points to Polygon, and after to SpatialPolygons, but
got error. Can anyone help me on this task?

Kind regards,

miltinho


createCircle <- function(x,y,r,start=0,end=2*pi,nsteps=20,...){
 ## adapted from Barry Rowlingson (2004)
   rs <- seq(start,end,len=nsteps)
   xc <- x+r*cos(rs)
   yc <- y+r*sin(rs)
   polygon(xc,yc,...)

   my.pol<-cbind(xc,yc)
   return<-my.pol
}


plot(1:10, type="n")
my.circle1<-createCircle(5,5,2, col="blue")
my.circle2<-createCircle(7,6,1,col="transparent")
my.circle3<-createCircle(7,4.5,1.5,col="transparent")


my.circle1.Sr <- Polygon(my.circle1)
my.circle1.Sr.SpatPol <- SpatialPolygons(my.circle1.Sr)

	[[alternative HTML version deleted]]


