# NOT RUN {
library(rgdal)
library(sp)
data(edgeroi)
edgeroi$sites[edgeroi$sites$SOURCEID=="399_EDGEROI_ed095_1",]
edgeroi$horizons[edgeroi$horizons$SOURCEID=="399_EDGEROI_ed095_1",]
## spPoints:
sites <- edgeroi$sites
coordinates(sites) <- ~ LONGDA94 + LATGDA94
proj4string(sites) <- CRS("+proj=longlat +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +no_defs")
sites <- spTransform(sites, CRS("+init=epsg:28355"))
# }
# NOT RUN {
## plot points and grids:
pnts <- list("sp.points", sites, pch="+", col="black")
## load the 250 m grids:
if(requireNamespace("RCurl")){
rep = "https://raw.github.com/Envirometrix/PredictiveSoilMapping/master/extdata/"
x = tempfile(fileext = ".rda")
wget.check = Sys.which("wget")
if(!wget.check==""){
con <- download.file(paste0(rep, "edgeroi.grids.rda"), x, method="wget")
load(x)
str(edgeroi.grids)
gridded(edgeroi.grids) <- ~x+y
proj4string(edgeroi.grids) <- CRS("+init=epsg:28355")
spplot(edgeroi.grids[1], sp.layout=pnts)
## load the 100 m grids:
x2 = tempfile(fileext = ".rda")
con2 <- download.file(paste0(rep, "edgeroi.grids100.rda"), x2, method="wget")
load(x2)
str(edgeroi.grids100)
gridded(edgeroi.grids100) <- ~x+y
proj4string(edgeroi.grids100) <- CRS("+init=epsg:28355")
spplot(edgeroi.grids100["TI1LAN6"], sp.layout=pnts)
}
}
# }
Run the code above in your browser using DataLab