Interpolate values from a grid efficiently in R
I have a grid of ocean depth data by location, and am trying to interpolate depth values for a selection of GPS points. We've been using RSAGA::pick.from.points, which works fine for small data sets. require(RSAGA) depthdata <- cbind.data.frame(x=c(74.136, 74.135, 74.134, 74.133, 74.132, 74.131, 74.130, 74.129, 74.128, 74.127), y=rep(40, times=10), depth=c(-0.6, -0.6, -0.9, -0.9, -0.9, -0.9, -0.9, -0.9, -0.6, -0.6)) mylocs <- rbind(c(-74.1325, 40), c(-74.1305, 40)) colnames(mylocs) <- c("x", "y") results <- pick.from.points(data=mylocs, src=depthdata, pick=c("depth"), method="nearest.neighbour