r-spatial / gstat

Spatial and spatio-temporal geostatistical modelling, prediction and simulation
http://r-spatial.github.io/gstat/
GNU General Public License v2.0
195 stars 50 forks source link

Converting examples to sf -- get an error #46

Closed thk686 closed 5 years ago

thk686 commented 5 years ago

I am seeing:

Error in if (!sf::st_is_longlat(locations)) { : missing value where TRUE/FALSE needed

in krige

eg zinc.nvd <- krige(zinc ~ 1, locations = meuse, newdata = meuse.grid)

Edit:

OK. Looking at this again, I see the error. "st_is_longlast" returns NA if there is no CRS, so this statement is incorrect. You need:

if(is.na(sf::st_is_longlat(locations) || !sf::st_is_longlat(locations)) { ....

edzer commented 5 years ago

Thanks, Tim! Shoudl work now!

Nowosad commented 5 years ago

@edzer are there any plans for the CRAN updates soon? I teach a geostatistics course starting October and it would be great to use sf + stars there.

edzer commented 5 years ago

submitted to CRAN ...

Nowosad commented 5 years ago

Hi @edzer, sorry for bothering you again - are there any news related to the gstat CRAN update?

edzer commented 5 years ago

Thanks; uploaded again, let's see.

edzer commented 5 years ago

... on its way to CRAN now..