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

GMW Data conversion fails due to incorrect file name #80

Closed
karpfen opened this issue Aug 2, 2022 · 3 comments · Fixed by #81
Closed

GMW Data conversion fails due to incorrect file name #80

karpfen opened this issue Aug 2, 2022 · 3 comments · Fixed by #81
Assignees
Labels
bug Something isn't working

Comments

@karpfen
Copy link
Collaborator

karpfen commented Aug 2, 2022

When downloading GMW data, the package first downloads a zipped ShapeFile and then converts it to GeoPackage. However, for the conversion, it tries to use a non-existent file and the path has to be adapted manually.

Here's a reproducible example (tried in Windows 10, R 4.1.2, mapme.biodiversity version 0.1.1)

library(mapme.biodiversity)
library(sf)
poly_test <- st_polygon(
   list(
      cbind(
         c(174.4313, 174.4313, 174.432, 174.432, 174.4313),
         c(-36.27457, -36.27408, -36.27408, -36.27457, -36.27457)
      )
   )
)
poly_test <- st_sf(st_sfc(poly_test, crs = 4326))
mangrove <- poly_test %>%
   init_portfolio(2016,
                  verbose = TRUE) %>%
   get_resources(
     resources = c("mangrove")
   )

For me, this produces the following messages:

Starting process to download resource 'mangrove'........
Checking URLs for existence. This may take a while...
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=32s
Translating shapefiles to GeoPackages. This may take a while....
<Rcpp::exception: Cannot open "C:/path/to/script/mangrove/GMW_001_GlobalMangroveWatch_2016/01_Data/GMW_2016_v2.shp"; The file doesn't seem to exist.>
<simpleWarning: Download for resource mangrove failed. Returning unmodified portfolio object.>
Warning messages:
1: In init_portfolio(., 2016, verbose = TRUE) :
Parallel processing on Windows currently is not supported. Setting number of cores to 1
2: Download for resource mangrove failed. Returning unmodified portfolio object.

Only after creating the script from the error message and moving the ShapeFile there, the GeoPackage can be produced.

@goergen95
Copy link
Member

Thanks for reporting this issue. First of all, please consider updating mapme.biodiversity. Current CRAN release is 0.1.2, development version is 0.2.0. Please note that with 0.2.0 a lot of resources and indicators have been renamed so it is better to move to that version rather now than later. However, this will not fix the above mentioned issue. I did a little digging, and It seems that a new v3 of GMW was released recently. I will push an update here on GitHub very soon and hopefully we can also send it to CRAN during the next release.

@goergen95 goergen95 self-assigned this Aug 2, 2022
@goergen95 goergen95 added the bug Something isn't working label Aug 2, 2022
@goergen95 goergen95 linked a pull request Aug 2, 2022 that will close this issue
@goergen95
Copy link
Member

please install the latest development version via: remotes::install_github("mapme-initiative/mapme.biodiversity") and feel free to re-open if the issue persists.

@karpfen
Copy link
Collaborator Author

karpfen commented Aug 2, 2022

Thanks for the quick response!
I just tried it in the dev version and it works as expected now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants