[R-sig-Geo] Clip a polyline with a Polygon

Roger Bivand Roger.Bivand at nhh.no
Wed May 14 20:48:29 CEST 2014


On Wed, 14 May 2014, Wesley Roberts wrote:

> Dear r-sig-geo,
>
> I have been looking for a tool / method to clip a polyline using a polygon
> and cant seem to find a suitable solution. My task is as follows.
>
> I have a property boundary which is a polyline. I have a deforestation
> layer which is a polygon. In my property data set I have 23 boundaries. I
> need to calculated the ratio of threatened perimeter to actual perimeter.
> To do this I select each boundary and then clip the boundary with the
> deforestation layer. The boundaries that remain (are spatially coincident
> with the deforestation layer) then remain. I calculate the length of these
> and calculate my ratio. This task is very straight forward and can be easy
> accomplished using QGIS, however, I have shared boundaries and thus need to
> process each boundary separately. gIntersection does not return what I need.
>
> Can anyone help with a potential solution?

In a complex case with multiple possible misunderstandings, you must 
provide a toy example; if it substantiates your claim about gIntersection, 
you must also state which version of rgeos you are using.

Verbal hand-waving is not precise, code is more illuminating.

Roger

>
> Many thanks and kind regards,
> Wesley
>
>

-- 
Roger Bivand
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 mailing list