Dear ALL,

I need to intersect two polygons and generate a thirth object with the
intersect area/polygon). The sample bellow ilustrate part of the task
(Thanks Roger!). At the end I plot my two sample polygons, highlighting the
output that I am looking for (the red region). I know that I can use ArcGis
or other GIS software to do that. But I think that R could be a very
flexible solutions.

Kind regards,

Miltinho
=====================


require(maptools)
my.pol1<-cbind(x=c(3,7,7,3,3),y=c(2,2,6,6,2))
my.pol2<-cbind(x=c(6,9,9,6,6),y=c(4,4,9,9,4))


my.pol1.Sr <- Polygons(list(Polygon(my.pol1)), ID="1")
my.pol2.Sr <- Polygons(list(Polygon(my.pol2)), ID="2")

my.pols.SpatPol <- SpatialPolygons(list(my.pol1.Sr,my.pol2.Sr))

rn <- sapply(slot(my.pols.SpatPol, "polygons"), function(x) slot(x, "ID"))
df <- data.frame(rn=rn, row.names=rn)
all.pol <- SpatialPolygonsDataFrame(my.pols.SpatPol, data=df)

plot(my.pols.SpatPol, axes=T)
polygon(x=c(6,7,7,6,6),y=c(4,4,6,6,4), col="red")

	[[alternative HTML version deleted]]


