Skip to content
Back to formatted view

Raw Message

Message-ID: <CAOwKfPRvowAiy9hfCZNgW+ueNnMjHwGYREoidjWFKMX8kydJaA@mail.gmail.com>
Date: 2016-02-08T18:02:55Z
From: Josh O'Brien
Subject: rgeos::gBuffer() fails when passed a SpatialPolygonsDataFrame containing a single multi-part @Polygons object.
In-Reply-To: <CAOwKfPQeeMNrZhp=j-a6WxgD4HJjaynxWJvm9LNkwvbL4A6Muw@mail.gmail.com>

Oops. The post's title should have read "rgeos::gBuffer( , byid=TRUE)
fails when...". (I inadvertently left out the `byid=TRUE` bit).

My apologies.

On Mon, Feb 8, 2016 at 9:59 AM, Josh O'Brien <joshmobrien at gmail.com> wrote:
> Hello,
>
> Not sure if this would be considered a bug, but it did recently bite
> me (and might bite others using gBuffer(..., byid=TRUE)
> programatically).
>
>
>     library(sp)
>     library(rgdal)
>     library(rgeos)
>
>     ## Example SpatialPolygonsDataFrame
>     x <- readOGR(system.file("etc/shapes", package="spdep"), "sids")[c(89,28),]
>     plot(x, col=c('dodgerblue', 'wheat'))
>
>     ## Works fine on object with multiple @Polygons in @polygons, even
>     ## if one of the @Polygons is multi-part
>     gBuffer(x, width=0.01, byid=TRUE)
>
>     ## Works with a single single-part @Polygons object in @polygons
>     gBuffer(x[1,], width=0.01, byid=TRUE)
>
>     ## Fails with a single _multi-part_ @Polygons object in @polygons
>     gBuffer(x[2,], width=0.01, byid=TRUE)
>
>
> Thanks (and please let me know an rgeos-specific note like this would
> be better posted elsewhere),
>
> Josh O'Brien