Some time ago I posted my own answer to create a grid inside a country to be used in kriging interpolation:
0........0.kriging error messages, grid file problem ? (automap, gstat)
This grid was for South Africa. Now I have data point for Lesotho (the hole inside SA), but cant get around it, to work with both together. I need a joint grid for kriging in gstat.
I used makegrid in sp:
SA0 <- raster::getData("GADM", country = "South Africa", level = 0)
plot(SA0)
SA0grd <- makegrid(SA0, n = 2000)
colnames(SALgrd) <- c('Longitude','Latitude')
SA0grd_pts <- SpatialPoints(coords = SALgrd,
proj4string=CRS(proj4string(SA0)))
SALgrd_pts_in <- SALgrd_pts[SAL0, ]
plot(SALgrd_pts_in)
I tried this , did not worK
SAL0 <- raster::getData("GADM", country = c("South Africa", "Lesotho"), level = 0)
How can I create a grid for SA and Lesotho together?