[R-sig-Geo] Intersect shapefiles
A. Marcia BARBOSA
barbosa at uevora.pt
Thu Feb 18 12:58:40 CET 2016
Check out also function joinPolys in the PBSmapping package
(http://www.inside-r.org/packages/cran/pbsmapping/docs/joinPolys)
- - -
A. Márcia BARBOSA, post-doctoral fellow
CIBIO/InBIO - University of Évora (Portugal)
http://modtools.wordpress.com/barbosa
2016-02-18 10:04 GMT+00:00 Loïc Dutrieux <loic.dutrieux at wur.nl>:
> Hi,
>
> Have you tried gIntersection from the rgeos package.
>
> Given 3 SpatialPolygon* objects you can probably do something like:
>
> sp12 <- gIntersection(sp1, sp2)
> sp123 <- gIntersection(sp12, sp3)
>
> Cheers,
> Loïc
>
>
> On 02/18/2016 10:25 AM, John Wasige wrote:
>
>> Dear all,
>>
>> I have three shapefiles that I want to intersect. Any body with an idea on
>> how to do the intersection? Shapefiles below;
>> library(rgdal)
>> library(rgeos)
>> library(maptools)
>> library(sp)
>> ###shape1
>> Rain_poly_merge <- readOGR(dsn="G:/EPIC_CUP/Rain_poly_merge.shp",
>> layer="Rain_poly_merge")
>> Rain_poly_merge <- spTransform(Rain_poly_merge, CRS("+init=epsg:4326"))
>>
>> ###shape2
>> Rain_poly_merge <- readOGR(dsn="G:/EPIC_CUP/yield_maize_average2002.shp",
>> layer="Rain_poly_merge")
>> Rain_poly_merge <- spTransform(Rain_poly_merge, CRS("+init=epsg:4326"))
>>
>> ###shape3
>> Rain_poly_merge <- readOGR(dsn="G:/EPIC_CUP/yield_maize_average2008.shp",
>> layer="Rain_poly_merge")
>> Rain_poly_merge <- spTransform(Rain_poly_merge, CRS("+init=epsg:4326"))
>>
>> [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list