I want to perform a spatial join (one-to-many relation) between two Spatial Dataframe layers in R. More specifically, I have a set of lines (SpatialLinesDataframe) that need to be joined to the ID of a neighborhood (SpatialPolygonsDataframe) if they overlap with it.
I tried using the over function (as indicated below) and get the following error:
over.list <- over(lines, neighorhood, returnList = TRUE)
Error in RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) : rgeos_binpredfunc_prepared: maximum returned dense matrix size exceeded
I presume this is due to the size of the
sp objects (475365 and 170045, respectively). What is the best approach to go about doing this?