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

The package not run for previous download data, and do not start a new download data #49

Closed
karolazvdo opened this issue Jun 13, 2022 · 6 comments
Assignees
Labels

Comments

@karolazvdo
Copy link

I've been trying to run the tutorial example, but the error happens since the first step to download data for mapping the protected areas.

mlt_raw_pa_data <- wdpa_fetch("Malta", wait = TRUE, download_dir = rappdirs::user_data_dir("wdpar")) Error in checkError(res) : Undefined error in httr call. httr output: Failed to connect to localhost port 4567: Connection refused lie_raw_data <- wdpa_fetch("Liechtenstein", wait = TRUE) Error in checkError(res) : Undefined error in httr call. httr output: Failed to connect to localhost port 4567: Connection refused

And even if I try to run the next steps with a data downloaded diretcly from the website of Protected Planet, it is not works.

shp_data <- st_transform(shp, 4326) Error in UseMethod("st_transform") : no applicable method for 'st_transform' applied to an object of class "c('SpatialPolygonsDataFrame', 'SpatialPolygons', 'Spatial', 'SpatialVector')"

@jeffreyhanson jeffreyhanson self-assigned this Jun 14, 2022
@jeffreyhanson
Copy link
Collaborator

Hi @karolazvdo,

Thank you very much for reaching out!

Could you please confirm if you are using the CRAN version or GitHub version of the package? Because CRAN policies forbid frequent updates, the GitHub version of the package might have some updates that fix this issue. So, if you're using the CRAN version, could you please try the GitHub version (see here for instructions)? If that that doesn't work, could you please post your session information (output from running sessionInfo()) so I can get more information on your R setup?

Ah - may I ask how you're importing the Protected Planet data after downloading it? I would suggest using the wdpar::wdpa_read() function (see here for documentation). This function will read in the .zip file downloaded from Protected Planet (as an sf object). I might have this wrong, but based on the error message shown it seems like you might have imported the shapefile data as a SpatialPolygonsDataFrame object (e.g., using the rgdal::readOGR function or raster::shapefile() function) - is that right? If so, the reason for this error is that the st_transform() function is designed to work with sf objects (which are a different way R can store shapefiles, or spatial data in general). So, if you read in the data using wdpar::wdpa_read() then st_transform should work (alternatively, you could use sf::read_sf() to read shapefile/spatial data in as an sf object).

Does that help? Please let me know if anything I've written isn't clear, or if you have any further questions?

@karolazvdo
Copy link
Author

karolazvdo commented Jun 14, 2022 via email

@jeffreyhanson
Copy link
Collaborator

jeffreyhanson commented Jun 14, 2022

Ah ok - yeah, thanks for trying the GitHub version. I sometimes encountered this error in earlier versions of the package if I accidently closed R while it was downloading the data - and the only way to fix that was restarting the computer, so maybe you could try that? Also, did the wdpa_read() function work?

@jeffreyhanson
Copy link
Collaborator

@karolazvdo, I just wanted to follow up and ask if that solved the issue?

@karolazvdo
Copy link
Author

karolazvdo commented Jul 4, 2022 via email

@jeffreyhanson
Copy link
Collaborator

Ah ok - sorry I'm sorry we couldn't get it working on your computer. Is there anything else I can help with? If not, I'll close this issue.

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

2 participants