'Is there a workaround for an elevatr error in R?

I am trying to extract elevation values for a series of coordinates using the elevatr package in R. According to one of the vignettes (https://cran.r-project.org/web/packages/elevatr/vignettes/introduction_to_elevatr.html), the following code should work:

require(sp)
require(elevatr)

ex.x <- c(-9.979167, -9.937500, -9.895833)
ex.y <- c(64.97917, 64.97917, 64.97917)
ex.df <- data.frame(x = ex.x, y = ex.y)
ex.sp <- sp::SpatialPoints(ex.df, proj4string = CRS("+proj=longlat +datum=WGS84"))

ex.epqs <- get_elev_point(EU.elev.sp, src = "epqs")

This code works up until I try to extract the elevation values, at which point it returns the following error:

Error in h(simpleError(msg, call)) : 
  error in evaluating the argument 'CRSobj' in selecting a method for function 'spTransform': NA

Does anybody know the reason this error occurs or how to fix it? Is elevatr broken or is there something else going on?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source