ropensci / FedData

Functions to Automate Downloading Geospatial Data Available from Several Federated Data Sources
https://docs.ropensci.org/FedData
Other
99 stars 22 forks source link

get_nlcd() error when year is default 2021. #122

Open lukeloken opened 1 week ago

lukeloken commented 1 week ago

Thank you for expanding FedData to include the newest year of the NLCD! I am finding an error when using the get_nlcd() function for the newest year, 2021.

library(FedData)

#Previous default
NLCD_2019 <- get_nlcd(
  template = FedData::meve,
  year = 2019,
  label = "meve"
)

terra::plot(NLCD)

# Version 4.1 default
NLCD_2021 <- get_nlcd(
  template = FedData::meve,
  year = 2021,
  label = "meve"
)
Error in h(simpleError(msg, call)) : 
  error in evaluating the argument 'x' in selecting a method for function 'as.factor': [rast] cannot open this file as a SpatRaster: C:\Users\lloken\AppData\Local\Temp\1\RtmpMXPGcj\file3128f58988.tif

I'm wondering if this has to do with a new file format and the transition away from sp and raster packages?

kevinwolz commented 1 week ago

I can confirm that I am experiencing the same issues. My error also came with a warning. Here are both:

Error in h(simpleError(msg, call)) : 
  error in evaluating the argument 'x' in selecting a method for function 'as.factor': [rast] cannot open this file as a SpatRaster: /private/var/folders/4p/mpc8rykn1svfp0dd6639lkw40000gn/T/RtmpcNFdHt/file115439716e9a.tif
In addition: Warning message:
`/private/var/folders/4p/mpc8rykn1svfp0dd6639lkw40000gn/T/RtmpcNFdHt/file115439716e9a.tif' not recognized as a supported file format. (GDAL error 4) 
>