[R-sig-Geo] Clearing the area outside of a polygon defined on a grid.

Roger Bivand Roger.Bivand at nhh.no
Fri Nov 16 08:00:40 CET 2012


On Thu, 15 Nov 2012, peleve wrote:

> Thanks Robert,
> I was able to do it with the following using the 'gpclib" package:

For completeness, please use rgeos rather than gpclib, which we are 
advising against strongly, because of the unclear and very restrictive 
licence of its included C code. rgeos contains gpclib classes and methods 
using GEOS rather than GPC under the hood, and should give identical 
results. It would be very helpful if you could confirm that the same code 
run in rgeos gives the same results. Once you get to rgeos, you may then 
find that there are efficiency gains in using rgeos wrappers to GEOS 
functions directly.

Roger

>
> p2 <- as(xy, "gpc.poly")
> p1 <- as(maparea, "gpc.poly")
> plot(setdiff(p1, p2), poly.args = list(col = 3), add = TRUE)
>
> Did exactly what I was looking for.  Pretty simple, actually.
>
> Thanks for inspiring me.
>
> Pete
>
>
>
>
> --
> View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Clearing-the-area-outside-of-a-polygon-defined-on-a-grid-tp7581718p7581727.html
> Sent from the R-sig-geo mailing list archive at Nabble.com.
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no



More information about the R-sig-Geo mailing list