Agustin Lobo wrote:
> Hi!
> 
> I have to create a shp of "circular" polygons
> out of a file with x,y coordinates and radii.
> 
> I've found that disc() from package GRID makes
> an owin object for each circle, but then how can
> I convert to sp (from there to shp using writeOGR)?

To generate n points on a circle centred at (x,y) of radius r you can do:

circle = 
function(x,y,r,n=100){t=seq(0,2*pi,len=n+1)[-1];return(cbind(r*sin(t),r*cos(t)))}

Increasing the n parameter makes the circle smoother. n=4 gives a 
square! Note this function doesn't generate duplicate points at start 
and finish.

  From here to sp should be trivial...

Barry

_______________________________________________
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to