[R-sig-Geo] Intersection of polygons and polylines

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Fri May 20 12:06:40 CEST 2011


On Fri, May 20, 2011 at 10:53 AM, Rija FANIRIANTSOA
<frijaf1 at mail2science.com> wrote:
>
> L<-SpatialLines(list(Lines(list(Line(cbind(c(7,6,5,4.2,3,2.8,1),
> c(4,3.5,3,2.8,2.5,1.8,1)))),"l1")))

 > require(rgeos)

 > gIntersects(L,polyg,byid=TRUE)
      l1
p1 FALSE
p2 FALSE
p3  TRUE
p4  TRUE

 - that gives you T/F for intersections of L with the polygons in
polyg. Job almost done!

Barry



More information about the R-sig-Geo mailing list