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 in sp::CRS(SRS_string = prj$wkt) : no arguments in initialization list #56

Closed
BFonteh opened this issue May 26, 2021 · 11 comments
Closed

Comments

@BFonteh
Copy link

BFonteh commented May 26, 2021

I recently installed elevatr in my linux system and I encountered this error when I tried running the sample code in the example on get_elev_points() function in the documentation. What am I supposed to change?

@jhollist
Copy link
Owner

What do you get with the following?

sessionInfo()
rgdal::getPROJ4VersionInfo()
rgdal::getGDALVersionInfo()

Most likely you have older versions of the required libraries (GDAL and PROJ).

@BFonteh
Copy link
Author

BFonteh commented May 26, 2021

sessionInfo()
rgdal::getPROJ4VersionInfo()
rgdal::getGDALVersionInfo()

sessionInfo()
R version 3.6.2 (2019-12-12)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: AIMS Desktop 2018.1

Matrix products: default
BLAS: /usr/lib/atlas-base/atlas/libblas.so.3.0
LAPACK: /usr/lib/atlas-base/atlas/liblapack.so.3.0

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8
[4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

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

other attached packages:
[1] dplyr_1.0.2 rgdal_1.5-23 sp_1.4-5 elevatr_0.3.4

loaded via a namespace (and not attached):
[1] Rcpp_1.0.5 rstudioapi_0.13 magrittr_2.0.1 units_0.7-1
[5] tidyselect_1.1.0 lattice_0.20-44 R6_2.5.0 rlang_0.4.10
[9] tools_3.6.2 grid_3.6.2 KernSmooth_2.23-16 e1071_1.7-7
[13] DBI_1.1.0 ellipsis_0.3.1 class_7.3-15 tibble_3.0.4
[17] lifecycle_1.0.0 crayon_1.3.4 sf_0.9-8 purrr_0.3.4
[21] vctrs_0.3.6 glue_1.4.2 proxy_0.4-25 pillar_1.4.7
[25] compiler_3.6.2 generics_0.1.0 classInt_0.4-3 pkgconfig_2.0.3

rgdal::getPROJ4VersionInfo()
[1] "Rel. 4.9.3, 15 August 2016, [PJ_VERSION: 493]"
attr(,"short")
[1] 493

rgdal::getGDALVersionInfo()
[1] "GDAL 2.1.2, released 2016/10/24"
The above are the details of the results

@jhollist
Copy link
Owner

Your version of R, GDAL, and PROJ are all old. Elevatr will not run on version 3.6.2. The oldest that I regularly test on is 3.6.3.

If you can, the easiest solution would be to update R and re-install rgdal, sp, sf, raster, and elevatr. I think you would also need to manually update GDAL and PROJ. Windows and I think now Mac handle those updates, but since you are on Linux that still needs to happen manually, I believe.

I also noticed that you are using AIMS Desktop (Just checked it out. Looks like a nice project!) On their website they have a 2020 version available. That might also solve the issue for you.

Good luck!

@rsbivand
Copy link

rsbivand commented Jun 10, 2021

@jhollist , sorry, you are missing the point, which is that on many legacy systems, old PROJ and GDAL run, because newer builds are not available. It isn't the R version, here it is the PROJ version, for which sp::CRS() cannot handle WKT as SRS_string=. I'm about to push a partial fix for the SRS_string="EPSG:XXXX" case, which fixes problems in MikkoVihtakari/ggOceanMaps#6, I think, but cannot fix yours, as you are passing a WKT string.

Most Centos clusters run old PROJ, I think this is the case here.

The key problem is that sp::CRS() will now return an NA CRS from things like CRS(SRS_string=ll_prj$wkt) , to which one cannot transform. Switching to say sf will not help, as the PROJ version remains the same, I think. Maybe consider using CRS(SRS_string=paste0("EPSG:", ll_prj$epsg)) and similar in the testthat spTransform() instances, which should work with both old and new PROJ, and thus also test cleanly on Solaris.

@rsbivand
Copy link

Modifications pushed to github.com:rsbivand/sp fixing the ggOceanMaps case, but your problem must be fixed in elevatr for older PROJ.

@jhollist
Copy link
Owner

@rsbivand Thanks for the clarification on this. All of the PROJ changes have clearly tied me in knots a bit.

I'll update my tests with your suggestion. Should be able to get to it sometime this week.

I appreciate you taking the time to push this fix (and for all you do for #rspatial)!

@jhollist
Copy link
Owner

jhollist commented Jul 15, 2021

Sorry for delay on getting to this, but I have the changes you suggest implemented in the tests . Working on getting a CRAN release ready. Hopefully by tomorrow...

@jhollist
Copy link
Owner

@rsbivand Updates just hit CRAN. I have an Red Hat machine with PROJ 4.8.0 on it. With the version of sp on https://github.com/rsbivand/sp I was able to test this new version without error. So, I think I got everything set. Thank you again for your help and patience!

@jhollist
Copy link
Owner

@Fonteh-Bonaventure can you confirm that the new version of elevatr on CRAN fixes the issue for you? I will wait a couple of weeks and if I don't hear otherwise will close this issue out.

@otsegun
Copy link

otsegun commented Nov 3, 2021

Hi @jhollist,
Thanks for your work on this package. Just want to add that I got this error and I was able to get it to work after installing the version of sp on https://github.com/rsbivand/sp like you mentioned above (I had sp version 1.4.5 from CRAN before). My current sessionInfo is:

R version 4.1.1 (2021-08-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.6 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 LC_TIME=es_ES.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=es_ES.UTF-8
[6] LC_MESSAGES=en_US.UTF-8 LC_PAPER=es_ES.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=es_ES.UTF-8 LC_IDENTIFICATION=C

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

other attached packages:
[1] elevatr_0.4.1 sp_1.4-6

loaded via a namespace (and not attached):
[1] Rcpp_1.0.7 pillar_1.6.4 compiler_4.1.1 progressr_0.9.0 prettyunits_1.1.1 progress_1.2.2 class_7.3-19
[8] viridis_0.6.2 tools_4.1.1 digest_0.6.28 dotCall64_1.0-1 lifecycle_1.0.1 tibble_3.1.5 gtable_0.3.0
[15] viridisLite_0.4.0 lattice_0.20-45 pkgconfig_2.0.3 rlang_0.4.12 DBI_1.1.1 curl_4.3.2 rgdal_1.5-27
[22] mvtnorm_1.1-3 spam_2.7-0 terra_1.4-11 gridExtra_2.3 e1071_1.7-9 raster_3.5-2 httr_1.4.2
[29] hms_1.1.1 vctrs_0.3.8 fields_13.3 maps_3.4.0 classInt_0.4-3 grid_4.1.1 glue_1.4.2
[36] sf_1.0-3 R6_2.5.1 fansi_0.5.0 foreign_0.8-81 ggplot2_3.3.5 purrr_0.3.4 magrittr_2.0.1
[43] codetools_0.2-18 units_0.7-2 scales_1.1.1 matrixStats_0.61.0 ellipsis_0.3.2 maptools_1.1-2 colorspace_2.0-2
[50] KernSmooth_2.23-20 utf8_1.2.2 proxy_0.4-26 munsell_0.5.0 crayon_1.4.2

Maybe this info might be useful for you.

@jhollist
Copy link
Owner

jhollist commented Nov 3, 2021

@otsegun Thank you! This is really helpful and I am happy to know that the fixes on GitHub appear to work.

@jhollist jhollist closed this as completed Nov 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants