[R-sig-Geo] rgeos::gBuffer quadsegs argument in respect to SpatialPoints -> SpatialPolygons

Colin Rundel rundel at gmail.com
Fri Apr 15 18:39:34 CEST 2011


> Which sp objects does quadsegs argument in gBuffer affect (or rather, which
> it does not)? Based on my experiments, SpatialPoints -> SpatialPolygons is
> not affected. I use SpatialPoints to draw circles (see below) and I figured
> that specifying the quadsegs would alter the "roughness" of the circle
> generated (which is now SpatialPolygons). This doesn't seem to be the case.
> Can someone expand on this?
> 
> sap <- gBuffer(spgeom = sap, width = 500, quadsegs = 5)
> nrow(sap at polygons[[1]]@Polygons[[1]]@coords) #always the same, irrespective
> of quadsegs


This should not be happening and when I run similar code I do get a difference in the number of coordinates as expected using the most current version of rgeos 0.1-4:

> x=SpatialPoints(cbind(x=1,y=1))
> z1=gBuffer(x,quadsegs=10)
> z2=gBuffer(x,quadsegs=5)
> nrow(z1 at polygons[[1]]@Polygons[[1]]@coords)
[1] 41
> nrow(z2 at polygons[[1]]@Polygons[[1]]@coords)
[1] 21

There may be some weirdness with your initial SpatialPoints object that is causing this but I don't have a plausible theory as to why. Try the above code and see if you still have the problem and double check that your rgeos is up to date.

-Colin


More information about the R-sig-Geo mailing list