You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am puzzled as the resulting crs of gstat-> predict seems the same as both inputs? Is this a spurious message, or a serious warning that I am doing something wrong (using an outdated crs?)?
Thanks!
library(gstat)
library(sf)
#> Linking to GEOS 3.10.1, GDAL 3.4.0, PROJ 8.2.0; sf_use_s2() is TRUE
library(sp)
packageVersion("gstat")
#> [1] '2.0.9'
packageVersion("sf")
#> [1] '1.0.6'
packageVersion("rgdal")
#> [1] '1.5.28'## prepare points and gridnc= st_read(system.file("shape/nc.shp", package="sf"), quiet=TRUE)
nc_points= st_sf(x=runif(6), geometry=st_sample(nc[1:3, ], 6) )
nc_grid<- st_make_grid(nc, n=3)
nc_points_sp<- as(nc_points, "Spatial")
nc_grid_sp<- as(nc_grid, "Spatial")
## run gstat on sf objectsgs_out<- gstat(formula=x~1, data=nc_points,
maxdist=80000,
set=list(idp=2))
z<- predict(gs_out, nc_grid[1])
#> Warning in proj4string(obj): CRS object has comment, which is lost in output; in tests, see#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html#> [inverse distance weighted interpolation]
st_crs(z) == st_crs(nc_grid)
#> [1] TRUE
st_crs(z) == st_crs(nc_points)
#> [1] TRUE## and on spgs_out_sp<- gstat(formula=x~1, data=nc_points_sp,
maxdist=80000,
set=list(idp=2))
z_sp<- predict(gs_out_sp, nc_grid_sp[1])
#> Warning in proj4string(obj): CRS object has comment, which is lost in output; in tests, see#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html#> [inverse distance weighted interpolation]
st_crs(z_sp) == st_crs(nc_grid_sp)
#> [1] TRUE
st_crs(z_sp) == st_crs(nc_points_sp)
#> [1] TRUE
When using
gstat
on an object with a crs, I get the warning:I am puzzled as the resulting crs of
gstat-> predict
seems the same as both inputs? Is this a spurious message, or a serious warning that I am doing something wrong (using an outdated crs?)?Thanks!
Created on 2022-03-21 by the reprex package (v2.0.1)
The text was updated successfully, but these errors were encountered: