我的 autoKrig 函数有问题,我尝试在这里制作一个可重现的示例:
library(automap)
library(raster)
library(dismo)
bio <- getData("worldclim", var="bio", res=10)
bio1 <- raster(bio, layer=1)
bio12 <- raster(bio, layer=12)
predictors <- stack(bio1, bio12)
bg <- randomPoints(bio1, 50)
data <- extract(predictors, bg)
data <- cbind(bg,data)
data <- data.frame(data)
coordinates(data)=~x+y
proj4string(data) = CRS("+proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0")
kg <- autoKrige(bio1~bio12, data, new_data=predictors)
这将导致:
Error in autoKrige(bio1 ~ bio12, data, new_data = predictors) :
Either input_data or new_data is in LongLat, please reproject.
input_data: +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0
new_data: +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0
我的原始数据出现同样的错误。我很感激任何帮助。