[R-sig-Geo] Cut SpatialLines into two Lines when intersecting with SpatialPolyon
Roger.Bivand at nhh.no
Tue Jun 3 11:22:45 CEST 2014
On Tue, 3 Jun 2014, Wouter Steenbeek wrote:
> [My apologies if this is a double post. I wrote the first post in HTML,
> and I think it may not have gotten through.]
Thanks for respecting our guidelines - it is much harder to infect plain
text, which is why HTML is not welcome.
> 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?
As in most cases, you will increase your chances of a reply if you provide
a toy example, for instance using readWKT() in rgeos to generate the
objects. Probably all you need is in rgeos, but without a toy example, it
is hard to give advice that isn't more like hand-waving.
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 91 00
e-mail: Roger.Bivand at nhh.no
More information about the R-sig-Geo