lifewatch / sdmpredictors

A compilation of environmental data for species distribution modelling
http://lifewatch.github.io/sdmpredictors/
Other
30 stars 6 forks source link

load_layers("BO_damean") gives error in .rasterObjectFromFile #16

Closed LennertSchepers closed 2 years ago

LennertSchepers commented 2 years ago

We received user feedback through mail from @MireiaValle:

load_layers("BO_damean")
trying URL 'http://www.lifewatch.be/sdmpredictors/BO_damean_lonlat.tif'
Content type 'application/zip' length 8300862 bytes (7.9 MB)
==================================================
downloaded 7.9 MB

Error in .local(.Object, ...) : 

In addition: Warning message:
In get_datadir(datadir) :
  file.path(tempdir(), "sdmpredictors") will be used as datadir, set options(sdmpredictors_datadir="<directory>") to avoid re-downloading the data in every session or set the datadir parameter in load_layers
Error in .rasterObjectFromFile(x, objecttype = "RasterBrick", ...) : 
  Cannot create a RasterLayer object from this file.

-> Feedback from @bart-v: If you just unzip the file (so you have a TIF file), before doing rasterObjectFromFile() this should work.

salvafern commented 2 years ago

I suspect you just need to reinstall the package.

We launched recently a new version of the package, being the diffuse attenuation one of the updated layers. The URL http://www.lifewatch.be/sdmpredictors/BO_damean_lonlat.tif does not exist anymore. It redirects to https://bio-oracle.org/data/1.0/BO_damean.zip. The new version of the package handles zipped files. There is more information here: https://github.com/lifewatch/sdmpredictors/releases/tag/v0.2.10

@MireiaValle Can you check the version of the package you are using and reinstall if this is older than 0.2.10?

packageVersion("sdmpredictors")

Let me know if this solves the issue.

LennertSchepers commented 2 years ago

As a side note to inform other people in the future; if handling the zipped files is new, can we update the release notes to include that? and I read "Currently uses layers from bio-oracle.org and lifewatch.be", but the news mentions that it uses the files from bio-oracle.org?

MireiaValle commented 2 years ago

I was using version 0.2.9, I updated it to 0.2.10 and now everything works! Thank you very much for your help @salvafern, @LennertSchepers and @bart-v. Best wishes!