On Fri, 27 Aug 2010, gianni lavaredo wrote:
dear Researcher,
it's friday afternoon i am starting to be tired. I don't rememeber the
method to convert a polygon class in a SpatialPolygonsDataFrame to use
overlay later. Sorry for destrub with this simple question.
thanks in advance Gianni
mywindow <- owin(myd...@bbox[1,],myd...@bbox[2,])
plot(mywindow, border="red")
points(centroid.owin(mywindow),pch=19,cex = 0.7)
xy.centr <- as.matrix(data.frame(centroid.owin(mywindow)))
# create a circle with the radius equal 1/2 the side of square area
big = disc(radius=100, centre=xy.centr[1,], npoly=4)
vert <- vertices(big)
# square of 200 x 200 m side
r <- as.rectangle(big)
plot(r, add=T)
vert.r.xy <- as.matrix(data.frame(vertices(r)))
vert.r.xy.poligon <- rbind(vert.r.xy,vert.r.xy[1,])
p <- Polygon(vert.r.xy.poligon, hole=as.logical(NA))
SP <- SpatialPolygons(list(Polygons(list(p), ID="1")))
should do it.
Roger
---------------------------
overlay
[[alternative HTML version deleted]]
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: roger.biv...@nhh.no
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo