Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when running wdpa_fetch() #69

Closed
Aisling-Wang opened this issue Jun 21, 2023 · 14 comments
Closed

Error when running wdpa_fetch() #69

Aisling-Wang opened this issue Jun 21, 2023 · 14 comments
Labels

Comments

@Aisling-Wang
Copy link

I am using version 4.3.1.

When I called lie_raw_data <- wdpa_fetch("Liechtenstein", wait = TRUE), I got the following error:
Error in session_makeRequest(self, private, endpoint, data, params, headers) :
Unable to find element with css selector '.download__trigger'

I am not familiar with css selector, so I don't know how to fix the problem. Anyone can help me? Thanks a lot.

@fBedecarrats
Copy link

Hello, same problem here. Does it correspond to a modification from the source portal?

@jeffreyhanson
Copy link
Collaborator

Hi,

Thank you very much for reporting this issue. I'm currently travelling so it might be a while before I can get to this. I'll see if I can find time later tonight - but no promises. In the mean time, you might be able to hopefully download the WDPA data manually and import the data from the zip file using wdpa_read() -- as long as Protected Planet hasn't updated the zip file format too.

@jeffreyhanson
Copy link
Collaborator

jeffreyhanson commented Jun 21, 2023

I'm having trouble accessing some parts of the protected planet website using a web browser. For example, when I try viewing the web page for the protected areas of Australia (i.e., https://protectedplanet.net/en/country/AUS), I see the error below.

image

So, my guess is that there's some issue with protected planet and this, in turn, is causing an issue for wdpar. So hopefullly, once protected planet fix the website, this will resolve the issue for wdpar? If anyone has any other ideas, I'd be happy to explore them? But it seems like we might have to wait for protected planet to fix things on their end.

@Aisling-Wang
Copy link
Author

Hi, Jeffrey. I can manually download the data of Australia on https://www.protectedplanet.net/country/AUS, but it is only the latest month. Now I want to download the global data for December 2019, but I don't know how to operate it.

@fBedecarrats
Copy link

Hi, Jeffrey. I can manually download the data of Australia on https://www.protectedplanet.net/country/AUS, but it is only the latest month. Now I want to download the global data for December 2019, but I don't know how to operate it.

Hi @Aisling-Wang, this question is not related to the wdpar package and you should ask it to the UNEP-WCMC peopole who produce the WDPA data.
Anyway, you can download the data you are looking for here: https://pp-import-production.s3-eu-west-1.amazonaws.com/WDPA_Dec2019_Public.zip

@Aisling-Wang
Copy link
Author

Thanks

Hi, Jeffrey. I can manually download the data of Australia on https://www.protectedplanet.net/country/AUS, but it is only the latest month. Now I want to download the global data for December 2019, but I don't know how to operate it.

Hi @Aisling-Wang, this question is not related to the wdpar package and you should ask it to the UNEP-WCMC peopole who produce the WDPA data. Anyway, you can download the data you are looking for here: https://pp-import-production.s3-eu-west-1.amazonaws.com/WDPA_Dec2019_Public.zip

Thanks.

@jeffreyhanson
Copy link
Collaborator

Just to give an update, I think I've found a fix to this problem. I'll try and push a branch with the fix later today so you can see if it works on your computers?

@fBedecarrats
Copy link

Hi, thanks!!! I'll need a couple of days to test. I'm currently traveling.

jeffreyhanson added a commit that referenced this issue Jul 4, 2023
@jeffreyhanson
Copy link
Collaborator

I think I've got it working now, could you please try installing the fixes branch and see if it works for you? This can be done using the following code:

remotes::install_github("prioritizr/wdpar@fixes")

@jeffreyhanson
Copy link
Collaborator

Hi @fBedecarrats and @Aisling-Wang, I just wanted to follow up and see if the updates in the fixes branch have fixed the wdpa_fetch() function for you?

@fBedecarrats
Copy link

Hi @jeffreyhanson, sorry for the delay. I'm still doing field work ik Senegal. I hope to be able to do it tomorrow.

@jeffreyhanson
Copy link
Collaborator

No worries @fBedecarrats! Thanks so much for the quick repsonse. I just wanted to make sure my previous message didn't get lost. Hope the field work goes well!

@fBedecarrats
Copy link

Hi @jeffreyhanson, Just did the tests and it seems that the fixes work. But what is most weird is that the CRAN version also works now:

# Use CRAN version
install.packages("wdpar")
library(wdpar)
webdriver::install_phantomjs()

lie_raw_data <- wdpa_fetch("Liechtenstein", wait = TRUE)
# [100%] Downloaded 11466840 bytes...
nrow(lie_raw_data)
# [1] 45

# Test fix branch
detach("package:wdpar", unload = TRUE)
remove.packages("wdpar")
remotes::install_github("prioritizr/wdpar@fixes")
library(wdpar)
lie_raw_data <- wdpa_fetch("Liechtenstein", wait = TRUE)
# no download progress message
nrow(lie_raw_data)
# [1] 45

@jeffreyhanson
Copy link
Collaborator

Brilliant - thanks so much @fBedecarrats!

Yeah, I dunno why the CRAN version is working again. I originally thought the issue with the downloading errors was due to issues with the protected planet website - so maybe they've fixed them now? I dunno. I'll merge the changes in the fix branch, since they seem to be more robust to issues with the protected planet website.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants