# Adjusting sampling points to closest land surface QGIS

I have many sampling points in mangroves of Southeast Asia and am trying to extract climatic data for each using the WorldClim dataset. However, many of the points fall on areas classified as "water" for which the WorldClim dataset values do not exist.

How do I adjust each of the point long/lat values to the closest land value in QGIS? Alternatively, if there's a way of doing so in Program R, I'd also be interested in that.

Perhaps it is easier to turn the solution around and expand the worldclim data a bit, via a focal operation that only fills in NA values. In R you can do that like this

r <- focal(x, w=matrix(1,nrow=5,ncol=5), fun=mean, na.rm=TRUE, NAonly=TRUE) z <- extract(xy, r)

wherexis the worldclim data and xy yourc(lon, lat)points.