[R-sig-Geo] Help with gpclib

hadley wickham h.wickham at gmail.com
Thu Jul 19 16:04:28 CEST 2012


> The chief problem is the totally unnecessary use of gpclib in fortify() in
> ggplot2. gpclib should never, ever be used, as its licence only permits
> hobby use to learn about polygon clipping - imposed against the author's
> will by his former university. The rgeos package provides all functionality
> provided by gpclib except breaking polygons into component triangles, which
> is not relevant here. Specifically, ggplot2/R/fortify-spatial.R says (l.
> 33-5):
>
>   # Union together all polygons that make up a region
>   try_require(c("gpclib", "maptools"))
>   unioned <- unionSpatialPolygons(cp, invert(polys))

That code is out of date. The current code is
https://github.com/hadley/ggplot2/blob/master/R/fortify-spatial.r

That only uses try_require("maptools") (and only if you use a
non-default grouping). As far as I know, that should automatically
pick between gpclib and rgeos depending on which is installed.

Despite the license for gpclib making it only suitable for
"hobbyists", it is much easier to install than rgeos, which requires
an external install.

Hadley

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/



More information about the R-sig-Geo mailing list