[R-sig-Geo] intersection of two polygons

Stéphane Dray dray at biomserv.univ-lyon1.fr
Tue Mar 20 14:49:56 CET 2007


I have a code that do the job for polylist objects at 
http://biomserv.univ-lyon1.fr/~dray/files/softwares/spatialRLQ/spatialrlq.R

The function uses gpclib and only returns area or binary matrices (1 
intersect, 0 not). It could be easily modify to return the intersection 
of two polygons (remove the loops over the polylists and return interAB)



Roger Bivand wrote:
> On Tue, 20 Mar 2007, Sebastien wrote:
>
>   
>> Dear helpers,
>>
>> I need to find the intersection of two polygons. I have two overlapping 
>> polygons and I want to find the polygon corresponding to the common 
>> part. Is there a fonction, like unionSpatialPolygons which can do that. 
>> I have converted my polygons to "owin" and use the function 
>> 'intersect.owin' in the pachage spatstat but it returns a binary matrice 
>> of class "owin" or I would prefer a polygon.
>>     
>
> No, there is not. I think that joinPolys() in the PBSmapping package can
> do this, and you can get to the PBS PolySet representation using
> SpatialPolygons2PolySet() in the maptools package, but then you'd need to
> get back again to SpatialPolygons, which would involve coding. The 
> alternative of using gpclib like unionSpatialPolygons() would also 
> involve coding.
>
> Roger
>
>   
>> Thanks for your help,
>>
>> Sébastien Ollier
>>
>> ####    ####    ####
>> Sébastien Ollier
>> Maître de Conférences
>> Université Paris-Sud 11
>> Faculté des Sciences d'Orsay
>> Unité Ecologie, Systématique et Evolution
>> Département Biodiversité, Systématique et Evolution
>> UMR - 8079 UPS-CNRS-ENGREF
>> Bât. 360, 91405 ORSAY CEDEX
>> FRANCE
>> Tel : 33 (0) 1 69 15 56 70
>> Fax : 33 (0) 1 69 15 46 97
>> http://www.ese.u-psud.fr/
>> ####    ####    ####
>>
>>     
>
>   


-- 
Stéphane DRAY (dray at biomserv.univ-lyon1.fr )
Laboratoire BBE-CNRS-UMR-5558, Univ. C. Bernard - Lyon I
43, Bd du 11 Novembre 1918, 69622 Villeurbanne Cedex, France
Tel: 33 4 72 43 27 57       Fax: 33 4 72 43 13 88
http://biomserv.univ-lyon1.fr/~dray/




More information about the R-sig-Geo mailing list