Skip to content

R-sig-Geo Digest, Vol 66, Issue 18

1 message · Adrian Baddeley

#
Jim Burke <j.burke at earthlink.net> asked how to compute the intersection
 between a set of lines (roads) and a set of polygons (regions).

This can be done using the spatstat package.

     1. convert the polygons from the class SpatialPolygons (in the sp package)
        to the class owin (in the spatstat package). See the vignette in the spatstat
       package for details.

    2. convert the lines (roads) to the class psp (in the spatstat package)  similarly.

    3. Use "[.psp" to clip the lines to the polygons. If X is your road network
       and W is a polygon then X[W] is the road network clipped inside W.

 Adrian Baddeley