Closed abuabara closed 2 years ago
@abuabara I just tried your code and it runs fine on my machine. Must be something local for you.
Also, your CRS and coordinates look off to me. The coordinates you specify for the bbox look like a geographic (e.g lat long), but you specify a UTM CRS. My understanding is that UTM coords are positive.
My guess is that you have our extent defined in something like EPSG 4326 and you would need to specify that first. Then use spTransfrom to make the transformation from geographic to utm. Here is an example that works on my machine and returns the elevation for College Station (I assume that is the correct location).
library(raster)
library(elevatr)
library(mapview)
bbox <- c(left = -96.55391,
bottom = 30.27192,
right = -95.97096,
top = 30.73099)
aux <- as.numeric(bbox)
e <- as(raster::extent(aux[1], aux[3], aux[2], aux[4]), "SpatialPolygons")
proj4string(e) <- CRS("EPSG:4326")
e <- spTransform(e, CRS("+proj=utm +zone=10 +datum=WGS84"))
x <- elevatr::get_elev_raster(e, z=9, src="aws") # 1 to 14
mapview(x)
Thank you so much for getting back!! Yes, that's right, College Station. I'm trying to show the package in the GIS Day here. Long time user. I learned it from Robin Lovelace in a R meeting in Prague, a couple of years ago. Since then, having been finding different uses of it for teaching.
I still get the fatal error. I have no idea what it could be. I'm using an intel Mac. I gonna try later in a different/spare computer and get back here when I find the problem. Thank you so much again!!!
Very cool! Thanks for spreading the word about it. If you have any nice examples, let me know about them. I am starting to collect and share use cases. Doing it just on the README now, but I should try and get a site up about the package and would move those use cases there.
What version of R/RStudio (if using) are you currently on? An update to one or both might help? (I am grasping at straws here!)
Also post your sessionInfo() and I'll see if anything jumps out at me.
Oh yah! Please check it out here: https://github.com/abuabara/TxGIS-Day-2021
The r-spatial presentation pdf shows (in the end) an example where the students try to find a 5-minutes distance and estimate the elevation of such area ... or if the area are in the lower part of the county.
It's a simple use, but get people excited and willing to learn it more.
Also, I'm working in the development of hurricane evacuation zones here in Texas, and trying to compare the elevations with the surge risk maps that NOAA provides, to try to find possible risk areas that the surge maps do not capture. Still in progress and all the time trying to convince people to use R instead of Arcmap!!
I'm really not sure about the crash. Already tried to reinstall everything and clean caches. get_elev_raster
complete the download, but it crash in the end. Probably when trying to merge the tiles, I think. Already tried to uncheck GPU options and rendering engines of RStudio. No success. The session info is:
`
sessionInfo() R version 4.1.2 (2021-11-01) Platform: x86_64-apple-darwin17.0 (64-bit) Running under: macOS Monterey 12.0.1 Matrix products: default LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base
other attached packages: [1] mapview_2.10.0 elevatr_0.4.1 raster_3.5-2 sp_1.4-6
loaded via a namespace (and not attached): [1] Rcpp_1.0.7 pillar_1.6.4 compiler_4.1.2 progressr_0.9.0 base64enc_0.1-3
[6] class_7.3-19 tools_4.1.2 digest_0.6.28 satellite_1.0.4 lifecycle_1.0.1
[11] tibble_3.1.6 lattice_0.20-45 png_0.1-7 pkgconfig_2.0.3 rlang_0.4.12
[16] DBI_1.1.1 crosstalk_1.2.0 rgdal_1.5-27 fastmap_1.1.0 e1071_1.7-9
[21] terra_1.4-20 dplyr_1.0.7 htmlwidgets_1.5.4 generics_0.1.1 vctrs_0.3.8
[26] webshot_0.5.2 stats4_4.1.2 classInt_0.4-3 leaflet_2.0.4.1 grid_4.1.2
[31] tidyselect_1.1.1 glue_1.5.0 sf_1.0-4 R6_2.5.1 fansi_0.5.0
[36] purrr_0.3.4 magrittr_2.0.1 scales_1.1.1 htmltools_0.5.2 codetools_0.2-18
[41] ellipsis_0.3.2 units_0.7-2 assertthat_0.2.1 colorspace_2.0-2 KernSmooth_2.23-20 [46] utf8_1.2.2 proxy_0.4-26 munsell_0.5.0 leafem_0.1.6 crayon_1.4.2 `
after removing R, cleaning the framework folder (./Library/Frameworks/R.framework), I installed R again and it went back to work ¯_(ツ)_/¯
Not sure what would be the reason. Have tried different locations and zooms. Getting R Session Aborted and R encountered a fatal error.