In rgeos, the typical output if there is no positional data is
the R NULL value. One might go towards objects with mixed
geometries (GDAL is permitting them for the drivers that have
them in the development version), but I don't see an analytical
need.
How often does, for example, newdata for predicting from a
geostatistical model include both points and lines?
Roger
Robert
On Thu, Oct 3, 2013 at 6:29 AM, Roger Bivand
<Roger.Bivand at nhh.no> wrote:
On Thu, 3 Oct 2013, Barry Rowlingson wrote:
Using scot_BNG from the rgdal package:
dsn <- system.file("vectors", package = "rgdal")[1]
scot_BNG <- readOGR(dsn=dsn, layer="scot_BNG")
and buffering with a sufficiently large negative width:
b=gBuffer(scot_BNG,width=-10000,byid=TRUE)
produces an object that gives an error on plot:
Yes, but ...
The user gets a SpatialPolygonsDataFrame object with the data
slot intact, but some of the polygons are clearly now
invalid. Should we do book-keeping to only retain the data
slot rows for valid polygons, only return the subset of valid
polygons, or proceed as now, and have the user do:
plot(b[gArea(b, byid=TRUE) > 0,])
What makes more sense? I'm open to suggestions ...
Roger
Error in checkSlotAssignment(object, name, value) :
assignment of an object of class ?NULL? is not valid for
slot "coords" in an object of class ?Line?; is(value,
"matrix") is not TRUE
Which I think is because the negative buffer has shrunk a
feature to nothing.
b[1,] is fine but:
Error in SpatialPolygons(x at polygons[i], proj4string =
CRS(proj4string(x))) : INTEGER() can only be applied to a
'integer', not a 'NULL'
I'm not sure what the right thing to do here is. Either
return a valid zero-area polygon (if that's not a
contradiction in terms) or drop the degenerate cases?
Barry