Skip to content
Prev 21121 / 29559 Next

Cut SpatialLines into two Lines when intersecting with SpatialPolyon

[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