[R-sig-Geo] Intersect shapefiles

Worrall, James -FS jworrall at fs.fed.us
Thu Feb 18 22:07:41 CET 2016

> -----Original Message-----
> From: Roger Bivand [mailto:Roger.Bivand at nhh.no]
> Sent: Thursday, February 18, 2016 12:01 PM
> To: Worrall, James -FS <jworrall at fs.fed.us>
> Cc: Help R-Sig_Geo <r-sig-geo at r-project.org>
> Subject: Re: [R-sig-Geo] Intersect shapefiles
> Please feel free to contribute; the description section shall be short, what you
> seem to want is in the details a little further down the page:
> "Returns an sp object with intersecting geometries merged. If geometries do
> not intersect then both are returned as distinct subgeometries."

I think this was the confusing part to me, but I am easily confused.  If two polygons overlap, in my mind the two polygons are intersecting geometries, and thus gIntersection should return the two polygons, in their entirety, merged.  Of course, this is the same as gUnion, so that doesn't make sense.

I made some simple polygons and tested to make sure gIntersection and gUnion behave as I now think they do.

Maybe it would be clearer to say something like, "Returns an sp object with intersecting (overlapping) portions of intersecting geometries merged.  Non-intersecting portions of intersecting geometries are removed.  If geometries do not intersect then both are returned as distinct subgeometries."

> I guess this is easier to grasp than the JTS original describing the binary union
> operator: "Computes a Geometry representing all the points in this Geometry
> and other" at
> http://www.vividsolutions.com/jts/javadoc/com/vividsolutions/jts/geom/Geo
> metry.html#union%28com.vividsolutions.jts.geom.Geometry%29
Yes indeed!

This electronic message contains information generated by the USDA solely for the intended recipients. Any unauthorized interception of this message or the use or disclosure of the information it contains may violate the law and subject the violator to civil or criminal penalties. If you believe you have received this message in error, please notify the sender and delete the email immediately.

More information about the R-sig-Geo mailing list