[R-sig-Geo] Cut SpatialLines into two Lines when intersecting with SpatialPolyon

Wouter Steenbeek WSteenbeek at nscr.nl
Tue Jun 3 11:04:52 CEST 2014


[My apologies if this is a double post. I wrote the first post in HTML, and I think it may not have gotten through.]

I have a SpatialLines(DataFrame) (e.g. streets) and SpatialPolygons(DataFrame) (e.g. neighborhoods). When a Line intersects with a polygon boundary, I want to split this Line into two new Lines. So: if a street begins in one neighborhood and ends in another neighborhood, I want to remove the original SpatialLine and replace that by two SpatialLines (streets): one street from the starting point until the intersection with the polygon boundary, and another street from the intersection with the polygon boundary to the original end point.

Can someone give me advice on how to do this?

Cheers,
Wouter



More information about the R-sig-Geo mailing list