Open everydayduffy opened 3 years ago
I am not on my machine right now so can't look too closely at this, but I noticed you are on an old version of elevatr. Current version on CRAN is 0.3.4. can you update this and confirm that you are still having this issue?
On Fri, Feb 26, 2021, 7:05 AM James P. Duffy notifications@github.com wrote:
Hello,
I'm afraid this is another issue likely related to the recent large changes to PROJ & GDAL. I get the following error when running:
elevation <- elevatr::get_elev_raster(lake,z = 9) Error in h(simpleError(msg, call)) : error in evaluating the argument 'CRSobj' in selecting a method for function 'spTransform': NA
I've narrowed it down to this line of code:
https://github.com/jhollist/elevatr/blob/4c45d548231400284f72b92b42dff6d9fd9a0928/R/internal.R#L196
...and found that changing it to:
locations <- sp::spTransform(locations, sp::CRS("+proj=longlat +datum=WGS84 +no_defs"))
...resolves the issue.
I think this shouldn't be a breaking change and wondered whether you might consider implementing it?
Here is my sessioninfo / rgdal loading text if useful:
Platform: x86_64-w64-mingw32/x64 (64-bit)Running under: Windows 10 x64 (build 18363) Matrix products: default locale: [1] LC_COLLATE=English_United Kingdom.1252 [2] LC_CTYPE=English_United Kingdom.1252 [3] LC_MONETARY=English_United Kingdom.1252 [4] LC_NUMERIC=C [5] LC_TIME=English_United Kingdom.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] rgdal_1.5-23 elevatr_0.3.1 raster_3.4-5 sp_1.4-5 sf_0.9-7 loaded via a namespace (and not attached): [1] Rcpp_1.0.5 magrittr_2.0.1 hms_1.0.0 progress_1.2.2 [5] units_0.6-7 tidyselect_1.1.0 lattice_0.20-41 R6_2.5.0 [9] rlang_0.4.10 httr_1.4.2 dplyr_1.0.4 tools_4.0.3 [13] grid_4.0.3 KernSmooth_2.23-18 e1071_1.7-4 DBI_1.1.1 [17] ellipsis_0.3.1 class_7.3-18 tibble_3.0.6 lifecycle_0.2.0 [21] crayon_1.4.1 purrr_0.3.4 codetools_0.2-18 vctrs_0.3.6 [25] curl_4.3 glue_1.4.2 compiler_4.0.3 pillar_1.4.7 [29] prettyunits_1.1.1 generics_0.1.0 classInt_0.4-3 pkgconfig_2.0.3 ```
when loading rgdal
Loading required package: sprgdal: version: 1.5-23, (SVN revision 1121)Geospatial Data Abstraction Library extensions to R successfully loadedLoaded GDAL runtime: GDAL 3.2.1, released 2020/12/29Path to GDAL shared files: C:/R/R403/library/rgdal/gdalGDAL binary built with GEOS: TRUE Loaded PROJ runtime: Rel. 7.2.1, January 1st, 2021, [PJ_VERSION: 721]Path to PROJ shared files: C:/R/R403/library/rgdal/projPROJ CDN enabled: FALSELinking to sp version:1.4-5To mute warnings of possible GDAL/OSR exportToProj4() degradation,use options("rgdal_show_exportToProj4_warnings"="none") before loading rgdal.Overwritten PROJ_LIB was C:/R/R403/library/rgdal/proj
P.S I think in the much longer term, switching to sf/stars/terra would help solve such issues, but understand that would be a massive undertaking. Oh and thank you for making a very useful package!
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jhollist/elevatr/issues/48, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJPYSZ5GIJT3NFTYDO55JTTA6FCFANCNFSM4YIKODTA .
Thanks for the quick response. I rolled back the version to see if the issue persisted. Have updated and confirm that I get the same error in 0.3.1 & 0.3.4
I am not able to recreate this on my machine with the same versions as you (only diff is a slightly older OS)
Here's my sessionInfo(): R version 4.0.3 (2020-10-10) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 17763)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages: [1] stats graphics grDevices utils datasets methods base
other attached packages: [1] sf_0.9-7 raster_3.4-5 elevatr_0.3.4 rgdal_1.5-23 sp_1.4-5
loaded via a namespace (and not attached):
[1] Rcpp_1.0.6 magrittr_2.0.1 hms_1.0.0 progress_1.2.2
[5] units_0.6-7 tidyselect_1.1.0 lattice_0.20-41 R6_2.5.0
[9] rlang_0.4.10 httr_1.4.2 dplyr_1.0.2 tools_4.0.3
[13] grid_4.0.3 KernSmooth_2.23-17 e1071_1.7-4 DBI_1.1.1
[17] ellipsis_0.3.1 class_7.3-17 yaml_2.2.1 tibble_3.0.5
[21] lifecycle_0.2.0 crayon_1.4.1 purrr_0.3.4 codetools_0.2-16
[25] vctrs_0.3.6 curl_4.3 glue_1.4.2 compiler_4.0.3
[29] pillar_1.4.7 prettyunits_1.1.1 generics_0.1.0 classInt_0.4-3
[33] pkgconfig_2.0.3
Oh, and totally agree about the switch to sf. On my list. Need to think on the raster to stars or terra switch.
Out of interest, could you share the output when you load rgdal for the first time please? I think our underlying libraries might be different versions...
They look the same to me: Loading required package: sp rgdal: version: 1.5-23, (SVN revision 1121) Geospatial Data Abstraction Library extensions to R successfully loaded Loaded GDAL runtime: GDAL 3.2.1, released 2020/12/29 Path to GDAL shared files: C:/Program Files/R/R-4.0.3/library/rgdal/gdal GDAL binary built with GEOS: TRUE Loaded PROJ runtime: Rel. 7.2.1, January 1st, 2021, [PJ_VERSION: 721] Path to PROJ shared files: C:/Program Files/R/R-4.0.3/library/rgdal/proj PROJ CDN enabled: FALSE Linking to sp version:1.4-5 To mute warnings of possible GDAL/OSR exportToProj4() degradation, use options("rgdal_show_exportToProj4_warnings"="none") before loading rgdal. Overwritten PROJ_LIB was C:/Program Files/R/R-4.0.3/library/rgdal/proj
That being said, elevatr wasn't erroring for me, but I can recreate that error on my machine if I run that line on its own.
Could you try: sp::CRS(SRS_string = "EPSG:4326") in that line on your machine to confirm that it fixes the issue?
I am reluctant to roll back to the PROJ4 string since everything is moving in the other direction.
That being said, elevatr wasn't erroring for me, but I can recreate that error on my machine if I run that line on its own.
Could you try: sp::CRS(SRS_string = "EPSG:4326") in that line on your machine to confirm that it fixes the issue?
This is really frustrating, as all I get from running this command on it's own is an NA:
library(sp)
library(rgdal)
sp::CRS(SRS_string = "EPSG:4326")
Error in sp::CRS(SRS_string = "EPSG:4326") : NA
And the same happens when placed within the spTransform:
locations <- sp::spTransform(locations, sp::CRS(SRS_string = "EPSG:4326"))
Error in h(simpleError(msg, call)) :
error in evaluating the argument 'CRSobj' in selecting a method for function 'spTransform': NA
I'm a bit stumped as to where the differences are in our setups, and why this doesn't work for me.
I am reluctant to roll back to the PROJ4 string since everything is moving in the other direction.
No worries, that's understandable.
For now I've taken a fork and done an alternative install, so I have a working version to use!
I am totally baffled by this one. I can't seem to recreate the error on my machine now. Happened once, but not now...
Maybe a wholesale upgrade to 4.0.4 with all new packages would fix it? Or, your own version should work for now. Sorry about this. I'll admit to having about a 10% understanding of the PROJ/GDAL changes and what needs to happen on my end. From what I can tell, PROJ4 is what is going away, replaced by WKT or other methods that can more completely/acurately describe the CRS.
Another option is to roll back to elevatr 0.2.0. If the AWS tiles are what you want then I think the results should be the same.
Haha no worries, it is very difficult to pin down... Just for the record, I did a clean install of R4.0.4 and got the following:
library(elevatr)
data(lake)
x <- get_elev_raster(lake, z = 12)
Error in sp::CRS(prj) :
PROJ4 argument-value pairs must begin with +: PROJCRS["unknown",
BASEGEOGCRS["unknown",
DATUM["North American Datum 1983",
ELLIPSOID["GRS 1980",6378137,298.257222101,
LENGTHUNIT["metre",1]],
ID["EPSG",6269]],
PRIMEM["Greenwich",0,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8901]]],
CONVERSION["unknown",
METHOD["Albers Equal Area",
ID["EPSG",9822]],
PARAMETER["Latitude of false origin",40,
ID["EPSG",8821]],
PARAMETER["Longitude origin",-96,
ID["EPSG",8822]],
1st standard parallel",20,
ID["EPSG",8823]],
2nd parallel",60,
ID["EPSG",8824]],
PARAMETER["Easting at origin",0,
LENGTHUNIT["metre",1],
ID["EPSG",8826]],
PARAMETER["Northing ID["EPSG",8827]]],
CS[Cartesian,2],
AXIS["(E)",east,
ORDER[1],
LENGTHUNIT["metre",1,
ID["EPSG",9001]]],
AXIS["(N)",north,
ORDER[2],
ID["EPSG",9001]]]]
and then when loading rgdal in...
library(rgdal)
library(elevatr)
x <- get_elev_raster(lake, z = 12)
Error in h(simpleError(msg, call)) :
error in evaluating the argument 'CRSobj' in selecting a method for function 'spTransform': NA
I think the most solid solution would be switching to sf::st_transform from sp::spTransform. I'd be happy to help you with this for the estimate_raster_size
if you'd like? And I agree with your synthesis of the whole situation. It hasn't been that well communicated by those making the sweeping changes IMO.
@everydayduffy can you confirm your sp
version?
packageVersion("sp")
@jhollist - I've got sp 1.4.5
Hi @jhollist,
Unforutnately, I'm still getting issues with the spTransform line mentioned at the start of this issue thread. It's a bit of a nightmare this rspatial stuff at the moment! Please let me know if I can help with switching at least some parts to an sf framework. Happy to start the ball rolling with a pull request, let me know!
Hi @jhollist I have the same issue using the example code, this is my session info:
R version 4.0.5 (2021-03-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19041)
Matrix products: default
locale:
[1] LC_COLLATE=Spanish_Chile.1252 LC_CTYPE=Spanish_Chile.1252 LC_MONETARY=Spanish_Chile.1252
[4] LC_NUMERIC=C LC_TIME=Spanish_Chile.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] sf_0.9-5 ggplot2_3.3.3 reshape2_1.4.4 rayshader_0.19.2 elevatr_0.3.4 raster_3.3-13
[7] sp_1.4-2
loaded via a namespace (and not attached):
[1] progress_1.2.2 tidyselect_1.1.0 xfun_0.17 purrr_0.3.4
[5] lattice_0.20-41 colorspace_1.4-1 vctrs_0.3.4 generics_0.1.0
[9] miniUI_0.1.1.1 htmltools_0.5.0 rlang_0.4.10 manipulateWidget_0.10.1
[13] e1071_1.7-3 pillar_1.6.0 later_1.1.0.1 withr_2.2.0
[17] glue_1.4.2 DBI_1.1.1 foreach_1.5.1 lifecycle_1.0.0
[21] plyr_1.8.6 stringr_1.4.0 munsell_0.5.0 gtable_0.3.0
[25] htmlwidgets_1.5.3 codetools_0.2-18 knitr_1.33 fastmap_1.0.1
[29] doParallel_1.0.16 httpuv_1.5.4 crosstalk_1.1.1 parallel_4.0.5
[33] class_7.3-18 Rcpp_1.0.5 KernSmooth_2.23-18 xtable_1.8-4
[37] scales_1.1.1 promises_1.1.1 classInt_0.4-3 webshot_0.5.2
[41] jsonlite_1.7.1 mime_0.9 hms_1.0.0 digest_0.6.25
[45] stringi_1.5.3 dplyr_1.0.2 shiny_1.5.0 grid_4.0.5
[49] rgdal_1.5-16 tools_4.0.5 magrittr_2.0.1 rgl_0.100.54
[53] tibble_3.0.6 crayon_1.4.1 pkgconfig_2.0.3 ellipsis_0.3.1
[57] prettyunits_1.1.1 rstudioapi_0.13 iterators_1.0.13 R6_2.5.0
[61] units_0.6-7 compiler_4.0.5
@arielfuentes Which code exactly is throwing the error? I had an issue in the development version that was causing my vignette some problems. I think I have that fixed (not yet pushed), but without know your exact issue hard to say what the problem is. If you can provide a reproducible example, I will take a look.
@jhollist Even though I'm not on my laptop the code was the following:
mt_mans <- data.frame(x = -72.8145, y = 44.5438)
mts <- rbind(mt_wash,mt_mans)
ll_prj <- "EPSG:4326"
mts_sp <- sp::SpatialPoints(sp::coordinates(mts),
proj4string = sp::CRS(ll_prj))
get_elev_point(locations = mts_sp)
But in the PC at my office works and I don't know why (it is very good news though), my session info on this machine is:
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)
Matrix products: default
locale:
[1] LC_COLLATE=Spanish_Mexico.1252 LC_CTYPE=Spanish_Mexico.1252
[3] LC_MONETARY=Spanish_Mexico.1252 LC_NUMERIC=C
[5] LC_TIME=Spanish_Mexico.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] elevatr_0.3.4
loaded via a namespace (and not attached):
[1] Rcpp_1.0.5 magrittr_2.0.1 hms_1.0.0 progress_1.2.2
[5] units_0.6-7 tidyselect_1.1.0 lattice_0.20-41 R6_2.5.0
[9] rlang_0.4.10 fansi_0.4.2 httr_1.4.2 dplyr_1.0.2
[13] tools_4.0.3 rgdal_1.5-23 grid_4.0.3 xfun_0.18
[17] tinytex_0.26 KernSmooth_2.23-17 utf8_1.2.1 e1071_1.7-4
[21] DBI_1.1.0 ellipsis_0.3.1 class_7.3-17 tibble_3.0.4
[25] lifecycle_1.0.0 sf_0.9-6 crayon_1.4.1 purrr_0.3.4
[29] vctrs_0.3.4 curl_4.3 glue_1.4.2 sp_1.4-4
[33] compiler_4.0.3 pillar_1.5.1 prettyunits_1.1.1 generics_0.1.0
[37] classInt_0.4-3 jsonlite_1.7.1 pkgconfig_2.0.3
What could be the reason that it works on a machine and not on the other?
This problem is linked back to how sp, raster, sf, etc. are dealing with coordinate reference systems. There have been a number of changes in the last year or so because the underlying libraries (e.g. GDAL, PROJ, etc.) have been updated. Given all that, the two machines can have different package versions and/or different versions of the underlying libraries. That could easily be the cause of the different behavior on different machines.
I did see different version of rgdal which could be the problem. First thing to try is to make sure all your packages are up to date. At a minimum do fresh installs of rgdal, sp, sf, and raster. After that try again with the examples.
Thank you @jhollist, the lack of update for the sp library was causing the issue.
@arielfuentes and @everydayduffy I pushed an update to CRAN yesterday that I hope fixes this problem. I am pretty sure it is linked to an older version of PROJ which doesn't like WKT. It might still fail and if so, there is a change for sp that once incorporated will fix it.
All, I am going to leave this open as I think I have it solved as well as I can with sp
still involved. I have one more release of elevatr slated with sp
. I am about 90% of the way done with transitioning solely to sf
. Once that is done, this issue will mostly be moot. Will close it when I get the sf
changes completed. Thanks for bearing with me on this!
All, I am going to leave this open as I think I have it solved as well as I can with
sp
still involved. I have one more release of elevatr slated withsp
. I am about 90% of the way done with transitioning solely tosf
. Once that is done, this issue will mostly be moot. Will close it when I get thesf
changes completed. Thanks for bearing with me on this!
Keep up the good work!
Hi to all, It looks like the issue is back. When using elevatr with updated packages for sp, sf, raster and using GDAL 3.2.1,
> rgdal::getGDALVersionInfo()
[1] "GDAL 3.2.1, released 2020/12/29"
I get the error 'spTransform' : NA
in get_elev_raster
related to
> sp::CRS(SRS_string = "EPSG:4326")
Error in sp::CRS(SRS_string = "EPSG:4326") : NA
I tried the github version of elevatr, with no changes. On an other setup linked to GDAL 3.0.2, everything is fine. However, I can't find a way to roll back from 3.2 to 3.0.
Any hints on how to solve this ?
R version 4.1.2 (2021-11-01)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22000)
Matrix products: default
locale:
[1] LC_COLLATE=French_France.1252 LC_CTYPE=French_France.1252 LC_MONETARY=French_France.1252 LC_NUMERIC=C
[5] LC_TIME=French_France.1252
system code page: 65001
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] stars_0.5-5 abind_1.4-5 glue_1.6.1 accessibility_0.2 rJava_1.0-6 sf_1.0-5 data.table_1.14.2
[8] tmap_3.3-2 tictoc_1.0.1 forcats_0.5.1 stringr_1.4.0 dplyr_1.0.7 purrr_0.3.4 readr_2.1.2
[15] tidyr_1.2.0 tibble_3.1.6 ggplot2_3.3.5 tidyverse_1.3.1
loaded via a namespace (and not attached):
[1] leafem_0.1.6 colorspace_2.0-2 ellipsis_0.3.2 class_7.3-19 leaflet_2.0.4.1 rgdal_1.5-28
[7] rprojroot_2.0.2 gtfsio_1.0.0 base64enc_0.1-3 fs_1.5.2 dichromat_2.0-0 rstudioapi_0.13
[13] proxy_0.4-26 listenv_0.8.0 remotes_2.4.2 fansi_1.0.2 lubridate_1.8.0 xml2_1.3.3
[19] codetools_0.2-18 cachem_1.0.6 pkgload_1.2.4 jsonlite_1.7.3 tmaptools_3.1-1 broom_0.7.12
[25] dbplyr_2.1.1 png_0.1-7 compiler_4.1.2 httr_1.4.2 backports_1.4.1 assertthat_0.2.1
[31] fastmap_1.1.0 cli_3.1.1 htmltools_0.5.2 prettyunits_1.1.1 tools_4.1.2 gtable_0.3.0
[37] Rcpp_1.0.8 cellranger_1.1.0 raster_3.5-15 vctrs_0.3.8 progressr_0.10.0 leafsync_0.1.0
[43] crosstalk_1.2.0 lwgeom_0.2-8 globals_0.14.0 ps_1.6.0 brio_1.1.3 testthat_3.1.2
[49] rvest_1.0.2 lifecycle_1.0.1 devtools_2.4.3 XML_3.99-0.8 future_1.23.0 terra_1.5-17
[55] scales_1.1.1 tidytransit_1.3.0 hms_1.1.1 geodist_0.0.7 parallel_4.1.2 RColorBrewer_1.1-2
[61] qs_0.25.2 curl_4.3.2 memoise_2.0.1 stringi_1.7.6 desc_1.4.0 checkmate_2.0.0
[67] e1071_1.7-9 zip_2.2.0 pkgbuild_1.3.1 rlang_1.0.1 pkgconfig_2.0.3 lattice_0.20-45
[73] elevatr_0.4.2 htmlwidgets_1.5.4 processx_3.5.2 tidyselect_1.1.1 parallelly_1.30.0 magrittr_2.0.2
[79] R6_2.5.1 generics_0.1.2 DBI_1.1.2 pillar_1.7.0 haven_2.4.3 withr_2.4.3
[85] units_0.7-2 sp_1.4-7 modelr_0.1.8 crayon_1.4.2 KernSmooth_2.23-20 utf8_1.2.2
[91] RApiSerialize_0.1.0 tzdb_0.2.0 progress_1.2.2 usethis_2.1.5 grid_4.1.2 readxl_1.3.1
[97] callr_3.7.0 reprex_2.0.1 digest_0.6.29 classInt_0.4-3 RcppParallel_5.1.5 munsell_0.5.0
[103] stringfish_0.15.5 viridisLite_0.4.0 sessioninfo_1.2.2
I am not able to recreate your issue with sp::CRS(SRS_string = "EPSG:4326")
. I get a valid WKT and all our versions appear to match with one exception. I noticed that you are on the dev version of sp. Current CRAN version is 1.4-6. Maybe try a reinstall of sp from CRAN?
That being said, current dev version and CRAN versions both worked fine for me.
sp dev or CRAN give the same result on my system. I think it is related to GDAL version ?
I am on the same GDAL version. Tracking down these small differences can be a challenge!
and what is your PROJ version?
Le jeu. 3 févr. 2022 à 19:39, Jeffrey W Hollister @.***> a écrit :
I am on the same GDAL version. Tracking down these small differences can be a challenge!
— Reply to this email directly, view it on GitHub https://github.com/jhollist/elevatr/issues/48#issuecomment-1029287562, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANA2KEKR7BWC32E4MOZPVUTUZLDXZANCNFSM4YIKODTA . You are receiving this because you commented.Message ID: @.***>
7.2.1
I think I nailed it. It should be related to rgdal::get_proj_search_paths() and I have installed postgresql with geometry extension which may have changed it (to a folder inside postgresql folder, an older version of PROJ). On my other computer it is pointing to rgdal in RLIBS (rlibs/4.1.2/rgdal/proj), and I have no issue. I'll test changing that tomorrow.
Le jeu. 3 févr. 2022 à 19:50, Jeffrey W Hollister @.***> a écrit :
7.2.1
— Reply to this email directly, view it on GitHub https://github.com/jhollist/elevatr/issues/48#issuecomment-1029296165, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANA2KEPVXFFPHRQEHFVAARDUZLFALANCNFSM4YIKODTA . You are receiving this because you commented.Message ID: @.***>
That sounds promising! Let me know if that was the issue. I wouldn't be surprised if some of the issues others reported that we couldn't track down were caused by similar things.
That's it. I found a way to restore a correct path, using PROJ_USER_WRITABLE_DIRECTORY as en environment variable. There is also a windows environment variable named PROJ_LIB that could be the culprit.
Le jeu. 3 févr. 2022 à 20:27, Jeffrey W Hollister @.***> a écrit :
That sounds promising! Let me know if that was the issue. I wouldn't be surprised if some of the issues others reported that we couldn't track down were caused by similar things.
— Reply to this email directly, view it on GitHub https://github.com/jhollist/elevatr/issues/48#issuecomment-1029325831, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANA2KENERO5EPOTQAMZ22TTUZLJLFANCNFSM4YIKODTA . You are receiving this because you commented.Message ID: @.***>
I am having the same issue: on window 11
downloading DEM via package elevatr Error in h(simpleError(msg, call)) : error in evaluating the argument 'CRSobj' in selecting a method for function 'spTransform': NA
In case you sokved the problem?, what can you suggest?
Thanks
check that rgdal::get_proj_search_paths()
points to the proj folder inside rgdal (it should be something like "....../rlibs/4.1.2/rgdal/proj
".
If not, change it using rgdal::set_proj_search_paths()
or by setting an environ variable PROJ_USER_WRITABLE_DIRECTORY to the correct path (in .Renviron for instance). That should help.
Hi Xavier, These are the output of suggested command, looks proj not found I think.
rgdal::get_proj_search_paths()
[1] "C:\Users\sarr\AppData\Local/proj" "C:\BASINS41\bin\PROJ_NAD"
rgdal::set_proj_search_paths()
Error in rgdal::set_proj_search_paths() : !missing(paths) is not TRUE Below is the correct to proj from rgdat C:/Users/sarr/Documents/R/win-library/4.1/rgdal/proj How the set the environment to point to that proj? Thanks for the support.
On Sat, Mar 5, 2022 at 5:34 PM Xavier Timbeau @.***> wrote:
check that rgdal::get_proj_search_paths() points to the proj folder inside rgdal (it should be something like "....../rlibs/4.1.2/rgdal/proj". If not, change it using rgdal::set_proj_search_paths() or by setting an environ variable PROJ_USER_WRITABLE_DIRECTORY to the correct path (in .Renviron for instance). That should help.
— Reply to this email directly, view it on GitHub https://github.com/jhollist/elevatr/issues/48#issuecomment-1059802332, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXY6LPYPHUZ3GOZYXIASVLU6OLLZANCNFSM4YIKODTA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you commented.Message ID: @.***>
Can you report back your sessionInfo()? just curious which versions of sp and rgdal you are running.
If you haven't updated in a while these problems are often resolved with an update. That being said, it does look like you might have some competing software issues here.
Also, what do you get with rgdal::getPROJ4VersionInfo()?
On Sun, Mar 6, 2022 at 7:44 AM fipoucat @.***> wrote:
Hi Xavier, These are the output of suggested command, looks proj not found I think.
rgdal::get_proj_search_paths()
[1] "C:\Users\sarr\AppData\Local/proj" "C:\BASINS41\bin\PROJ_NAD"
rgdal::set_proj_search_paths()
Error in rgdal::set_proj_search_paths() : !missing(paths) is not TRUE Below is the correct to proj from rgdat C:/Users/sarr/Documents/R/win-library/4.1/rgdal/proj How the set the environment to point to that proj? Thanks for the support.
On Sat, Mar 5, 2022 at 5:34 PM Xavier Timbeau @.***> wrote:
check that rgdal::get_proj_search_paths() points to the proj folder inside rgdal (it should be something like "....../rlibs/4.1.2/rgdal/proj". If not, change it using rgdal::set_proj_search_paths() or by setting an environ variable PROJ_USER_WRITABLE_DIRECTORY to the correct path (in .Renviron for instance). That should help.
— Reply to this email directly, view it on GitHub https://github.com/jhollist/elevatr/issues/48#issuecomment-1059802332, or unsubscribe < https://github.com/notifications/unsubscribe-auth/AAXY6LPYPHUZ3GOZYXIASVLU6OLLZANCNFSM4YIKODTA
. Triage notifications on the go with GitHub Mobile for iOS < https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675
You are receiving this because you commented.Message ID: @.***>
— Reply to this email directly, view it on GitHub https://github.com/jhollist/elevatr/issues/48#issuecomment-1059956232, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJPYS32YX5NWLG7BCGSEIDU6SSCHANCNFSM4YIKODTA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you were mentioned.Message ID: @.***>
-- Jeffrey W. Hollister email: @.*** cell: 401 556 4087 https://jwhollister.com
Sorry for the length.
rgdal::getPROJ4VersionInfo()
[1] "Rel. 7.2.1, January 1st, 2021, [PJ_VERSION: 721]"
attr(,"short")
[1] 721
sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19043)
Matrix products: default
Random number generation:
RNG: Mersenne-Twister
Normal: Inversion
Sample: Rounding
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] RNetCDF_2.5-2 raster_3.4-13 sp_1.4-5 elevatr_0.4.2
[5] ncdf4_1.18 microclima_0.1.0 mcera5_0.3.0 lubridate_1.8.0
[9] stars_0.5-5 sf_1.0-4 abind_1.4-5
loaded via a namespace (and not attached):
[1] nlme_3.1-153 fs_1.5.2 usethis_2.1.5 gmodels_2.18.1
[5] RColorBrewer_1.1-2 httr_1.4.2 rprojroot_2.0.2 tools_4.1.2
[9] utf8_1.2.2 rgdal_1.5-27 R6_2.5.1 rpart_4.1-15
[13] KernSmooth_2.23-20 spData_2.0.1 DBI_1.1.2 colorspace_2.0-3
[17] tidyselect_1.1.2 gridExtra_2.3 curl_4.3.2 compiler_4.1.2
[21] progressr_0.10.0 cli_3.1.0 expm_0.999-6 xml2_1.3.3
[25] scales_1.1.1 classInt_0.4-3 proxy_0.4-26 ecmwfr_1.3.0
[29] rappdirs_0.3.3 RNCEP_1.0.10 tgp_2.4-17 stringr_1.4.0
[33] digest_0.6.29 pkgconfig_2.0.3 fastmap_1.1.0 maps_3.4.0
[37] rlang_1.0.2 keyring_1.3.0 rstudioapi_0.13 httpcode_0.3.0
[41] generics_0.1.2 zoo_1.8-9 jsonlite_1.7.2 gtools_3.9.2
[45] spdep_1.1-12 dplyr_1.0.8 magrittr_2.0.1 s2_1.0.7
[49] dotCall64_1.0-1 Matrix_1.3-4 Rcpp_1.0.7 munsell_0.5.0
[53] fansi_0.5.0 maptree_1.4-7 viridis_0.6.2 lifecycle_1.0.1
[57] terra_1.4-22 stringi_1.7.6 MASS_7.3-54 plyr_1.8.6
[61] grid_4.1.2 parallel_4.1.2 rnoaa_1.3.8 gdata_2.18.0
[65] crayon_1.5.0 deldir_1.0-6 lattice_0.20-45 splines_4.1.2
[69] pillar_1.7.0 tcltk_4.1.2 boot_1.3-28 codetools_0.2-18
[73] LearnBayes_2.15.1 crul_1.2.0 wk_0.5.0 XML_3.99-0.9
[77] glue_1.5.0 hoardr_0.5.2 vctrs_0.3.8 spam_2.8-0
[81] gtable_0.3.0 purrr_0.3.4 tidyr_1.2.0 assertthat_0.2.1
[85] cachem_1.0.6 ggplot2_3.3.5 lwgeom_0.2-8 e1071_1.7-9
[89] coda_0.19-4 class_7.3-19 viridisLite_0.4.0 tibble_3.1.6
[93] memoise_2.0.1 fields_13.3 units_0.7-2 cluster_2.1.2
[97] ellipsis_0.3.2
On Sun, Mar 6, 2022 at 1:15 PM Jeffrey W Hollister @.***> wrote:
Can you report back your sessionInfo()? just curious which versions of sp and rgdal you are running.
If you haven't updated in a while these problems are often resolved with an update. That being said, it does look like you might have some competing software issues here.
Also, what do you get with rgdal::getPROJ4VersionInfo()?
On Sun, Mar 6, 2022 at 7:44 AM fipoucat @.***> wrote:
Hi Xavier, These are the output of suggested command, looks proj not found I think.
rgdal::get_proj_search_paths()
[1] "C:\Users\sarr\AppData\Local/proj" "C:\BASINS41\bin\PROJ_NAD"
rgdal::set_proj_search_paths()
Error in rgdal::set_proj_search_paths() : !missing(paths) is not TRUE Below is the correct to proj from rgdat C:/Users/sarr/Documents/R/win-library/4.1/rgdal/proj How the set the environment to point to that proj? Thanks for the support.
On Sat, Mar 5, 2022 at 5:34 PM Xavier Timbeau @.***> wrote:
check that rgdal::get_proj_search_paths() points to the proj folder inside rgdal (it should be something like "....../rlibs/4.1.2/rgdal/proj". If not, change it using rgdal::set_proj_search_paths() or by setting an environ variable PROJ_USER_WRITABLE_DIRECTORY to the correct path (in .Renviron for instance). That should help.
— Reply to this email directly, view it on GitHub <https://github.com/jhollist/elevatr/issues/48#issuecomment-1059802332 , or unsubscribe <
https://github.com/notifications/unsubscribe-auth/AAXY6LPYPHUZ3GOZYXIASVLU6OLLZANCNFSM4YIKODTA
. Triage notifications on the go with GitHub Mobile for iOS <
https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675
or Android <
.
You are receiving this because you commented.Message ID: @.***>
— Reply to this email directly, view it on GitHub https://github.com/jhollist/elevatr/issues/48#issuecomment-1059956232, or unsubscribe < https://github.com/notifications/unsubscribe-auth/ABJPYS32YX5NWLG7BCGSEIDU6SSCHANCNFSM4YIKODTA
. Triage notifications on the go with GitHub Mobile for iOS < https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675
You are receiving this because you were mentioned.Message ID: @.***>
-- Jeffrey W. Hollister email: @.*** cell: 401 556 4087 https://jwhollister.com
— Reply to this email directly, view it on GitHub https://github.com/jhollist/elevatr/issues/48#issuecomment-1059961073, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXY6LP5K35YG3YGOH26L3DU6SVXNANCNFSM4YIKODTA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you commented.Message ID: @.***>
@fipoucat Go ahead an update raster, sf, rgdal, and sp and try to run again. That might fix the issue.
Hello,
I'm afraid this is another issue likely related to the recent large changes to PROJ & GDAL. I get the following error when running:
I've narrowed it down to this line of code:
https://github.com/jhollist/elevatr/blob/4c45d548231400284f72b92b42dff6d9fd9a0928/R/internal.R#L196
...and found that changing it to:
locations <- sp::spTransform(locations, sp::CRS("+proj=longlat +datum=WGS84 +no_defs"))
...resolves the issue.
I think this shouldn't be a breaking change and wondered whether you might consider implementing it?
Here is my sessioninfo / rgdal loading text if useful:
P.S I think in the much longer term, switching to sf/stars/terra would help solve such issues, but understand that would be a massive undertaking. Oh and thank you for making a very useful package!