I have several data sets (~25 with all the same columns) for a total of ~ 400,000 observations. I am running a loop to extract road class for each data survey points. When I am running my script on a small data set (~ 4,000 obs) everything works fine. But when I run a loop with the same script I have an error (that stop the loop) after the first 47,000 obs. I googled that error and found no results. Any suggestions?
thanks Martin
Error in .Call("rgeos_intersects_prepared", .RGEOS_HANDLE, spgeom1, spgeom2, : negative length vectors are not allowed
here is part of the code I've used for my analysis
proj4string(Road) <- CRS("+proj=longlat +ellps=WGS84 +datum=WGS84")
Road_pc <- spTransform(Road, CRS = CRS("+init=epsg:2957"))
output <- NULL
for( j in 1:length(import.list)){
dfb <- as.data.frame(import.list[j])
coordinates(dfb) <- ~ coords.x1 + coords.x2
proj4string(dfb) <- CRS("+proj=longlat +ellps=WGS84 +datum=WGS84")
pc <- spTransform(dfb, CRS = CRS( "+init=epsg:2957" ))
pc100m <- gBuffer(pc, width=100, byid=TRUE )
zzc <- over(pc100m, Road_pc)
dfc <- cbind(dfb, zzc)
dfc$DAdates <- j
output<- rbind(dfc, output)
}
Well I am not sure of the reason, but when I run the script individually on each script. It works. It takes more time but it's working. m.