FRBCesab / worldpa

:package: Interface to the World Database on Protected Areas (WDPA)
https://frbcesab.github.io/worldpa/
GNU General Public License v3.0
14 stars 2 forks source link

get_wdpa(isocode = "USA") does not work #4

Open jkumagai96 opened 3 years ago

jkumagai96 commented 3 years ago

I am trying to download the protected areas of the United States of America. The ISO-3 code is USA. This line of code test <- get_wdpa(isocode = "USA") produces this error: Error: lexical error: invalid char in json text. <!DOCTYPE html> <!--[if lt IE 7 (right here) ------^

ahasverus commented 3 years ago

Hi Joy! Thanks for using my package (and testing it ;)! I tried to download PA of the USA and I had the same error as you. The Protected Planet changed its API (and the structure of the request response) and I need to adapt the code of the function worldpa::get_wdpa(). Maybe today, maybe tomorrow.

ahasverus commented 3 years ago

It seems that the WDPA server was in maintenance. It's all good now. Can you please tell me if you can download PA for the USA (it can take several long minutes)? Note that I modified the package and upgraded the version to 2.0.0 (read CHANGELOG/NEWS): I recommend you to reinstall the package from GitHub. Cheers!

jkumagai96 commented 3 years ago

Hi Nicolas! I apologize for the delayed response. I redownloaded the package from GitHub and still encounter the same error unfortunately. Not sure if it is an error on my end as I am having trouble installing rtools since I updated R studio and R to the most recent version.

ahasverus commented 3 years ago

Hi Joy! Did you try to download PA for another country? For instance, worldpa::get_wdpa(isocode = "GEO") works for me. Try this line (it will take a few seconds). If it does not work your system (R, Rtool and spatial libraries) needs to be reinstalled. You can take a look at these pages: https://github.com/r-spatial/sf#windows https://cran.r-project.org/bin/windows/Rtools/

ahasverus commented 3 years ago

I checked the code for the USA, and indeed there is an issue when downloading PA for the 2nd page (51 to 100). This a problem with the server (error 524). I wrote to the assistance. In the mean time you could directly download shapefile from the Protected Areas website.