prioritizr / wdpar

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

lwgeom::st_make_valid --> not exported object from namespace lwgeom #25

Closed carbonmetrics closed 4 years ago

carbonmetrics commented 4 years ago

The wdpa_clean function calls lwgeom::st_make_valid in a few places. This causes an error, because the lwgeom package does not have that function. I have replaced the calls with sf::st_make_valid, but that still returns an error after the function runs.

jeffreyhanson commented 4 years ago

Thanks for looking into this. Just to double check, are you using the newest version wdpar on CRAN (1.0.2)? You can check this using the code: packageVersion("wdpar"). The newest version should have fixed these issues, but I could have missed something?

carbonmetrics commented 4 years ago

Thanks for the quick reaction. I am using 1.0.2. - just installed from GitHub and upgraded all required/suggested packages. Same message.

ken_clean=wdpa_clean(ken_pa) removing areas that are not implemented: ✓ removing UNESCO reserves: ✓ removing points with no reported area: ✓ Error: 'st_make_valid' is not an exported object from 'namespace:lwgeom' packageVersion("wdpar") [1] ‘1.0.2’

info

library(wdpar) Loading required package: sf Linking to GEOS 3.8.0, GDAL 3.0.4, PROJ 7.0.0

sessionInfo() R version 3.6.3 (2020-02-29) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 18.04.4 LTS

Matrix products: default BLAS: /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3 LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.2.20.so

locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=nl_NL.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=nl_NL.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=nl_NL.UTF-8 LC_IDENTIFICATION=C

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] wdpar_1.0.2 sf_0.9-2

loaded via a namespace (and not attached): [1] compiler_3.6.3 magrittr_1.5 class_7.3-15
[4] DBI_1.1.0 tools_3.6.3 units_0.6-6
[7] Rcpp_1.0.4.6 KernSmooth_2.23-16 grid_3.6.3
[10] e1071_1.7-3 classInt_0.4-3

jeffreyhanson commented 4 years ago

Hmm, I'm having trouble reproducing this error. Could you please run the following code and post the output?

library(wdpar)
x <- wdpa_clean(suppressWarnings(wdpa_fetch("MHL")))

Also, could you please post your installed version of the lwgeom package?

carbonmetrics commented 4 years ago

It also works for me now! The error was copied/pasted from a vanilla R session after installation / updating ...don't ask. Thanks for your help!

jeffreyhanson commented 4 years ago

Ah ok - glad it's working now. I'll close this issue then, but please reopen it if you run into this problem again.