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

Adrian.Baddeley at csiro.au Adrian.Baddeley at csiro.au
Thu Feb 19 04:35:08 CET 2009


 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



More information about the R-sig-Geo mailing list