问题
I used these functions several times, and they were working perfect, nothing wrong with my input data!!
m<-raster::intersect(raster,shapefile)
or
n<-crop(raster, extent(shapefile))
I have to do this operation for a large set of data. Therefore, I tried to increase the speed of R by using multicore
. I did use multicore.tabulate.intersect function from here
However, nothing works for me. Then, whenever I run intersect or crop function I got this error:
m<-raster::intersect(raster,shapefile)
Error in file(fn, "rb") : cannot open the connection
In addition: Warning message:
In file(fn, "rb") :
cannot open file '/private/var/folders/57/dn1sv79j3zzgy01h2l9v89v80000gn/T/Rtmpg5AYsm/raster/r_tmp_2018-01-23_235923_1432_19427.gri': No such file or directory
> n<-crop(raster, extent(shapefile))
Error in file(fn, "rb") : cannot open the connection
In addition: Warning message:
In file(fn, "rb") :
cannot open file '/private/var/folders/57/dn1sv79j3zzgy01h2l9v89v80000gn/T/Rtmpg5AYsm/raster/r_tmp_2018-01-23_235923_1432_19427.gri': No such file or directory
I deleted R and reinstalled it, nothing changed the problem!!
I tried to reinstall raster package and I feel R couldn't find it:
install.packages("raster")'
The downloaded binary packages are in
/var/folders/57/dn1sv79j3zzgy01h2l9v89v80000gn/T//RtmpKDG7bH/downloaded_packages
Again try intersect
m<-raster::intersect(raster,shapefile)
Error in file(fn, "rb") : cannot open the connection
In addition: Warning message:
In file(fn, "rb") :
cannot open file '/private/var/folders/57/dn1sv79j3zzgy01h2l9v89v80000gn/T/Rtmpg5AYsm/raster/r_tmp_2018-01-23_235923_1432_19427.gri': No such file or directory
Appreciate any ideas!!
来源:https://stackoverflow.com/questions/48433790/cannot-open-the-connection-in-raster-r