[R-sig-Geo] gIntersection versus intersect

Robert J. Hijmans r.hijmans at gmail.com
Fri May 15 05:39:36 CEST 2015


Jean-Luc.

It is as you say, intersect returns Spatial*DataFrame objects whereas
gIntersect does not the DataFrame bits.
This pattern is also true for raster functions aggregate, union,
erase, cover and crop (see section XIV in ?'raster-package') which all
have their analogues in rgeos that they build on.
intersect uses gIntersection so it should not be faster.

Robert

On Thu, May 14, 2015 at 2:48 PM, Jean-Luc Dupouey <dupouey at nancy.inra.fr> wrote:
> For intersecting two polygon layers, is there any advantage of using
> gIntersection (from the rgeos package) instead of intersect (from the raster
> package)? After a few tests, it appears that intersect is a little bit
> faster. Moreover, intersect automatically calculates the associated
> dataframe, while gIntersection leaves the user making it.
>
> Thanks for your awer(s).
>
> Jean-Luc
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



More information about the R-sig-Geo mailing list