I am trying to make a spatial overlay between two polygons ("grd" and "range") using the over function (rgeos).

This code works for all files but one:

range.grd.overlay <- grd[!is.na(over(grd, range)), ]@data$grdID # get gridcells that overlap with range

and get this error message:

Error in createPolygonsComment(p) : 
  rgeos_PolyCreateComment: orphaned hole, cannot find containing polygon for hole at index 9

I understand that there is a hole without a surrounding polygon somewhere in the shapefile, but I can't figure out how to work around it. Can I simply delete the hole at index 9 ? How ? If you have a solution to fix the shapefile in ArcGIS that would also be fine for me.

Thanks a lot in advance for your help !!

Regards, Carsten

Edit
Report