[R-sig-Geo] rgeos::gBuffer(, byid=TRUE) fails
Roger Bivand
Roger.Bivand at nhh.no
Mon Feb 8 21:30:10 CET 2016
On Mon, 8 Feb 2016, Josh O'Brien wrote:
> 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).
>>
Thanks for a reproducible example - for rgeos 0.3-14 this gives a
segfault, in 0.3-16 an error as the data.frame has only one row, but three
Polygons objects are returned. As you note, the issue is triggered by
byid=TRUE but there is only one input object; only one buffer is created,
around the NE island.
I'll look into this - it'll need debugging in C, close to recent bug-fixes
(then concerned with pre-sp-MultiPoint object signalling - multiple
objects making up features).
And yes, this is a reasonable place to report, it should give users a
realistic view of how many corner cases actually exist and require
someone's attention.
Roger
>>
>> 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
>
> _______________________________________________
> 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, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 91 00
e-mail: Roger.Bivand at nhh.no
http://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
http://depsy.org/person/434412
More information about the R-sig-Geo
mailing list