I have a shapefile (showing different sediment classes in the northsea) read in with readOGR()
. It has a
lot of " what should be" holes in many polygons, but using rasterize()
does eliminate all the holes since they are not marked as TRUE
in their hole-slots. Used rasterize(...,fun='first')
with no success. Nevertheless, QGIS shows the holes all nicely. Also, over()
correctly evaluates the field values, e.g., in a hole, probably taking advantage of the slot "plot order" which is why I came up with something like:
for (i in 1:ncell(raster)){
coo<-xyFromCell(raster,i,spatial=T)
col<-colFromX(ra,coo@coords[1,1])
row<-rowFromY(ra,coo@coords[1,2])
proj4string(coo)<-proj4string(shape)
n<-over(coo,shape)
raster[col,row]<-n$Prime_FOLK
}
to bypass rasterize, but it will take 50days to be done.
So here' my question:
Has anyone experienced something similar and found a workaround for it?
(I would have liked include example data, but dput()
fails on SpatialPolygons?!?)