Error with get_elev_raster
Closed this issue · 10 comments
I was trying to replicate this repository and when I try to download the location data it gives me the following error:
Accessing raster elevation [=========================] 100% Mosaicing & Projecting Error in sf::gdal_utils(util = "warp", source = files, destination = destfile, : gdal_utils warp: an error occured In addition: Warning messages: 1: In CPL_gdalwarp(source, destination, options, oo, doo, quiet, "-overwrite" %in% : GDAL Error 1: Error: Failed to build program executable! Build Log: Error in processing command line: Don't understand command line argument "inff"! 2: In CPL_gdalwarp(source, destination, options, oo, doo, quiet, "-overwrite" %in% : GDAL Error 1: Error at file /build/gdal/src/gdal-3.5.1/alg/gdalwarpkernel_opencl.cpp line 2479: CL_BUILD_PROGRAM_FAILURE 3: In CPL_gdalwarp(source, destination, options, oo, doo, quiet, "-overwrite" %in% : GDAL Error 1: OpenCL routines reported failure (-11) on line 4695.
What can I do?
@ACalleros Hard to say without more details. It might be something to do with your local version of GDAL?
Can you provide the details of your sessionInfo()
and sf::sf_extSoftVersion()
?
Sorry, I forgot to include my session info
> sessionInfo()
R version 4.2.1 (2022-06-23)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Manjaro Linux
Matrix products: default
BLAS: /usr/lib/libopenblasp-r0.3.21.so
LAPACK: /usr/lib/liblapack.so.3.10.1
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=es_MX.UTF-8
[4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=es_MX.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=es_MX.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] forcats_0.5.2 stringr_1.4.0 dplyr_1.0.10 purrr_0.3.5 readr_2.1.3
[6] tidyr_1.2.1 tibble_3.1.8 ggplot2_3.4.0 tidyverse_1.3.2 terra_1.6-17
[11] showtext_0.9-5 showtextdb_3.0 sysfonts_0.8.8 metR_0.13.0 MexBrewer_0.0.1
[16] elevatr_0.4.3.9999
loaded via a namespace (and not attached):
[1] fs_1.5.2 sf_1.0-9 usethis_2.1.6 lubridate_1.9.0 devtools_2.4.4
[6] httr_1.4.4 tools_4.2.1 profvis_0.3.7 backports_1.4.1 utf8_1.2.2
[11] R6_2.5.1 KernSmooth_2.23-20 DBI_1.1.3 colorspace_2.0-3 withr_2.5.0
[16] urlchecker_1.0.1 sp_1.5-1 tidyselect_1.2.0 prettyunits_1.1.1 processx_3.8.0
[21] compiler_4.2.1 progressr_0.11.0 rvest_1.0.3 cli_3.4.1 xml2_1.3.3
[26] scales_1.2.1 checkmate_2.1.0 classInt_0.4-8 callr_3.7.3 proxy_0.4-27
[31] digest_0.6.30 pkgconfig_2.0.3 htmltools_0.5.3 sessioninfo_1.2.2 dbplyr_2.2.1
[36] fastmap_1.1.0 htmlwidgets_1.5.4 rlang_1.0.6 readxl_1.4.1 rstudioapi_0.14
[41] shiny_1.7.3 generics_0.1.3 jsonlite_1.8.3 googlesheets4_1.0.1 magrittr_2.0.3
[46] Rcpp_1.0.9 munsell_0.5.0 fansi_1.0.3 lifecycle_1.0.3 stringi_1.7.8
[51] pkgbuild_1.3.1 grid_4.2.1 promises_1.2.0.1 crayon_1.5.2 miniUI_0.1.1.1
[56] lattice_0.20-45 haven_2.5.1 hms_1.1.2 ps_1.7.2 pillar_1.8.1
[61] codetools_0.2-18 pkgload_1.3.1 reprex_2.0.2 glue_1.6.2 data.table_1.14.4
[66] remotes_2.4.2 modelr_0.1.9 vctrs_0.5.0 tzdb_0.3.0 httpuv_1.6.6
[71] cellranger_1.1.0 gtable_0.3.1 assertthat_0.2.1 cachem_1.0.6 mime_0.12
[76] xtable_1.8-4 broom_1.0.1 e1071_1.7-12 later_1.3.0 class_7.3-20
[81] googledrive_2.0.0 gargle_1.2.1 memoise_2.0.1 units_0.8-0 timechange_0.1.1
[86] ellipsis_0.3.2
> sf::sf_extSoftVersion()
GEOS GDAL proj.4 GDAL_with_GEOS USE_PROJ_H PROJ
"3.11.0" "3.5.1" "9.0.1" "true" "true" "9.0.1"
@ACalleros I am unable to recreate the error, I am on slightly different versions of GDAL and PROJ. One quick question, do you possibly have other versions of GDAL installed on your machines, perhaps via pip or from source? I am getting out of my depth a bit here but I do vaguely recall others having issues with multiple or failed GDAL installs.
Connecting this issue back to #62 as the errors are the same. I'm having this same problem in Ubuntu 22.04, whether I use sf
1.0.9 (current) or 1.0.6 as suggested in #62.
My sf
-associated packages are:
> sf_extSoftVersion()
GEOS GDAL proj.4 GDAL_with_GEOS USE_PROJ_H PROJ
"3.10.2" "3.4.1" "8.2.1" "true" "true" "8.2.1"
Might this be a problem with GDAL versions rather than sf? (Downgrading to sf
1.0.6 via source does not seem to also downgrade the dependencies.)
I am trying again on my PC with GDAL 3.5.2 and have it running right now on Debian with GDAL 3.2.2 too.
Can you run this with just a single state? Different Zoom level?
Wow! Very odd! When I run:
states <- us_states(states = c("AL", "FL"))
se.elevations <- get_elev_raster(locations = states, z = 10, clip = "locations")
It works without a problem. In fact, the whole plot works if I decrease z to 7 instead of 10. I guess the larger plot failing was a memory problem rather than a GDAL problem. Interesting that R didn't crash, but instead gave the gdalwarp
error.
Thanks for helping me figure out the issue.
Interesting! I got it to work with all the states by taking the zoom level down to 8. Thanks again for your help.