prioritizr / wdpar

Interface to the World Database on Protected Areas
https://prioritizr.github.io/wdpar
GNU General Public License v3.0
37 stars 5 forks source link

Error downloading "global" data with wdpa_fetch #79

Closed jaseeverett closed 3 months ago

jaseeverett commented 3 months ago

Hi @jeffreyhanson

Trying to download all the wdpa data with the "global" option and I get an error. Are you getting the same error?

I get the error whether I specific the download_dir or not.

wdpa_data <- wdpar::wdpa_fetch("global", wait = TRUE,
             download_dir = rappdirs::user_data_dir("wdpar"))
#> Warning in utils::unzip(x, exdir = tdir): error -1 in extracting from zip file
#> Error in wdpa_read(file_path, n): global data format not recognized.

Created on 2024-05-07 with reprex v2.1.0

jeffreyhanson commented 3 months ago

Hi @jaseeverett,

Thank you very much for reporting this! I'll look into it and try and get back to you later today.

jeffreyhanson commented 3 months ago

Hmm, it seems to work on my computer (Ubuntu). I assume this on your M1 Mac? Internally, wdpar uses the curl package to handle downloads - could you try updating that and see if it works? If not, we could try and debug this togeather over zoom/teams?

jeffreyhanson commented 3 months ago

Also, it might be possible that there was previously an issue when downloading the global dataset into the rappdirs::user_data_dir("wdpar") folder, so it's now failing when trying to import this cached data. So, maybe try deleting the global wdpar dataset from this folder and try running it again (so as to force wdpar to download the dataset again from Protected Planet)? Could you try running this code so that force wdpar is forced to re-download the data before trying to import it?

wdpa_data <- wdpar::wdpa_fetch("global", wait = TRUE, download_dir = rappdirs::user_data_dir("wdpar"), force_download = TRUE)
jaseeverett commented 3 months ago

Thanks @jeffreyhanson . No there isn't an issue with the cache. I tried it with new cache names, and also no cache and get the same issue. I just spoke to my student who reported it and he is using a 2018 MB Air. So possible a Mac issue, but not specific to the new Macs.

jaseeverett commented 3 months ago

I'll have a look at debugging it myself and get back to you. Stand by

jeffreyhanson commented 3 months ago

Just to follow up, were you able to debug the issue?

jaseeverett commented 3 months ago

Hey @jeffreyhanson . Yes I think I have but I'm just getting a student to test it on their computer to see if it works for them. Will get back to you shortly.

jaseeverett commented 3 months ago

81 should solve this