[R-sig-Geo] intersection of objects SpatialPolygonsDataFrame

Agustin Lobo Agustin.Lobo at ija.csic.es
Wed Apr 9 15:47:56 CEST 2008


Dear list,

I have two objects of class "SpatialPolygonsDataFrame"
and I want to get the intersection. The first object (x)
are circles (approached as polygons) with a fake data
frame. The circles could be just in a SpatialPolygons
object, I just put the fake data frame to get the same
class as I would have got from importing a shp file via readOGR.
The second object (absUTMpolysHABS2) is a map of habitats
(imported from a shp file
via readOGR). I want the circles to intersect the map
so that I can calculate the area of each habitat in
each circle. I'm not sure if I'm on the right path:

It seemed to me that I had to use function joinPolys()
with operation="INT" from package PBSmapping,

a <- (joinPolys(SpatialPolygons2PolySet(x), 
SpatialPolygons2PolySet(absUTMpolysHABS2)))

a looks good (circles subdivided into polygons)
but SpatialPolygons2PolySet() makes me loss the information
in the data frame of the map, so I do not know the habitat
for each polygon within each circle.

Any way to relate the new polygons to the data frame of the map?
Or should I use an entirely different apporach in R?
Or should I export x to a GIS and do this operation there?

Thanks!

Agus

-- 
Dr. Agustin Lobo
Institut de Ciencies de la Terra "Jaume Almera" (CSIC)
LLuis Sole Sabaris s/n
08028 Barcelona
Spain
Tel. 34 934095410
Fax. 34 934110012
email: Agustin.Lobo at ija.csic.es
http://www.ija.csic.es/gt/obster




More information about the R-sig-Geo mailing list