I have such data of points which could be stored with their radii.
cdf = rbind(matrix(c(100, 200, 10), ncol = 3), matrix(c(400, 300, 20), ncol = 3))
di = c("1", "2")
spcs <- list()
for (c in 1:dim(cdf)[1]) {
spc <- spCircle(radius = cdf[c,3], centerPoint = c(x=cdf[c,1], y=cdf[c,2]), spID = di[c])
spcs <- c(spcs, spc)
}
Now, how to add it as a polygon (as other "normal" polygons) to the whole processing of creation of shapefile layers?
I do with typical polygons this way:
sps <- SpatialPolygons(spcs)
sdf <- SpatialPolygonsDataFrame(sps, data.frame(x = rep(NA, length(sps)), row.names = di))
rgdal::writeOGR(obj = sdf, dsn = title, layer = name,
driver = "ESRI Shapefile", overwrite_layer = FALSE, verbose = TRUE)
but here the format is not the same. For example:
Error in SpatialPolygons(spcs) : no slot of name "area" for this object of class "SpatialPolygons"
How to add it as polygon
spCircle
function from thesampSurf
package?