USEPA / elevatr

An R package for accessing elevation data
Other
203 stars 26 forks source link

The elevatr package requires longitude in a range from -180 to 180. #70

Closed Nowosad closed 2 years ago

Nowosad commented 2 years ago

Hi @jhollist! The issue is related to #66. Providing non-longlat worked in the past, but currently returns an error. See a reprex (I am using the GitHub version of the package):

# remotes::install_github("jhollist/elevatr")
library(elevatr)
library(terra)
#> terra 1.5.21
library(sf)
#> Linking to GEOS 3.9.2, GDAL 3.3.3, PROJ 8.2.1; sf_use_s2() is TRUE
zion = read_sf(system.file("vector/zion.gpkg", package = "spDataLarge"))
el = get_elev_raster(zion, z = 8)
#> Error in loc_check(locations, prj): The elevatr package requires longitude in a range from -180 to 180.

Created on 2022-04-25 by the reprex package (v2.0.1)

Session info ``` r sessioninfo::session_info() #> ─ Session info ─────────────────────────────────────────────────────────────── #> setting value #> version R version 4.1.3 (2022-03-10) #> os Fedora Linux 35 (Thirty Five) #> system x86_64, linux-gnu #> ui X11 #> language (EN) #> collate en_US.UTF-8 #> ctype en_US.UTF-8 #> tz Europe/Warsaw #> date 2022-04-25 #> pandoc 2.14.0.3 @ /usr/libexec/rstudio/bin/pandoc/ (via rmarkdown) #> #> ─ Packages ─────────────────────────────────────────────────────────────────── #> package * version date (UTC) lib source #> assertthat 0.2.1 2019-03-21 [2] CRAN (R 4.1.1) #> class 7.3-20 2022-01-13 [2] CRAN (R 4.1.3) #> classInt 0.4-3 2020-04-07 [2] CRAN (R 4.1.1) #> cli 3.2.0 2022-02-14 [2] CRAN (R 4.1.2) #> codetools 0.2-18 2020-11-04 [2] CRAN (R 4.1.1) #> crayon 1.5.1 2022-03-26 [2] CRAN (R 4.1.2) #> DBI 1.1.2 2021-12-20 [2] CRAN (R 4.1.3) #> digest 0.6.29 2021-12-01 [2] CRAN (R 4.1.3) #> dplyr 1.0.8.9000 2022-04-05 [1] Github (tidyverse/dplyr@8abb54b) #> e1071 1.7-9 2021-09-16 [2] CRAN (R 4.1.1) #> elevatr * 0.4.2 2022-04-25 [1] Github (jhollist/elevatr@5dbdc77) #> ellipsis 0.3.2 2021-04-29 [2] CRAN (R 4.1.1) #> evaluate 0.15 2022-02-18 [2] CRAN (R 4.1.2) #> fansi 1.0.3 2022-03-24 [2] CRAN (R 4.1.2) #> fastmap 1.1.0 2021-01-25 [2] CRAN (R 4.1.1) #> fs 1.5.2 2021-12-08 [2] CRAN (R 4.1.2) #> generics 0.1.2 2022-01-31 [2] CRAN (R 4.1.2) #> glue 1.6.2 2022-02-24 [2] CRAN (R 4.1.2) #> highr 0.9 2021-04-16 [2] CRAN (R 4.1.1) #> htmltools 0.5.2 2021-08-25 [2] CRAN (R 4.1.1) #> KernSmooth 2.23-20 2021-05-03 [2] CRAN (R 4.1.1) #> knitr 1.38 2022-03-25 [2] CRAN (R 4.1.2) #> lattice 0.20-45 2021-09-22 [2] CRAN (R 4.1.1) #> lifecycle 1.0.1 2021-09-24 [2] CRAN (R 4.1.1) #> magrittr 2.0.3 2022-03-30 [2] CRAN (R 4.1.3) #> pillar 1.7.0 2022-02-01 [2] CRAN (R 4.1.2) #> pkgconfig 2.0.3 2019-09-22 [2] CRAN (R 4.1.1) #> progressr 0.10.0 2021-12-19 [2] CRAN (R 4.1.3) #> proxy 0.4-26 2021-06-07 [2] CRAN (R 4.1.1) #> purrr 0.3.4 2020-04-17 [2] CRAN (R 4.1.1) #> R.cache 0.15.0 2021-04-30 [2] CRAN (R 4.1.1) #> R.methodsS3 1.8.1 2020-08-26 [2] CRAN (R 4.1.1) #> R.oo 1.24.0 2020-08-26 [2] CRAN (R 4.1.1) #> R.utils 2.11.0 2021-09-26 [2] CRAN (R 4.1.1) #> R6 2.5.1 2021-08-19 [2] CRAN (R 4.1.1) #> Rcpp 1.0.8.3 2022-03-17 [2] CRAN (R 4.1.2) #> reprex 2.0.1 2021-08-05 [2] CRAN (R 4.1.1) #> rgdal 1.5-31 2022-04-18 [2] CRAN (R 4.1.3) #> rlang 1.0.2 2022-03-04 [2] CRAN (R 4.1.2) #> rmarkdown 2.13 2022-03-10 [2] CRAN (R 4.1.2) #> rstudioapi 0.13 2020-11-12 [2] CRAN (R 4.1.1) #> sessioninfo 1.2.2 2021-12-06 [2] CRAN (R 4.1.2) #> sf * 1.0-8 2022-04-07 [1] Github (r-spatial/sf@898b51e) #> sp 1.4-7 2022-04-20 [2] CRAN (R 4.1.3) #> stringi 1.7.6 2021-11-29 [2] CRAN (R 4.1.3) #> stringr 1.4.0 2019-02-10 [2] CRAN (R 4.1.1) #> styler 1.7.0 2022-03-13 [2] CRAN (R 4.1.2) #> terra * 1.5-21 2022-02-17 [2] CRAN (R 4.1.2) #> tibble 3.1.6 2021-11-07 [2] CRAN (R 4.1.3) #> tidyselect 1.1.2 2022-02-21 [2] CRAN (R 4.1.3) #> units 0.8-0 2022-02-05 [2] CRAN (R 4.1.3) #> utf8 1.2.2 2021-07-24 [2] CRAN (R 4.1.1) #> vctrs 0.4.1 2022-04-13 [2] CRAN (R 4.1.3) #> withr 2.5.0 2022-03-03 [2] CRAN (R 4.1.2) #> xfun 0.30 2022-03-02 [2] CRAN (R 4.1.2) #> yaml 2.3.5 2022-02-21 [2] CRAN (R 4.1.2) #> #> [1] /home/jn/R/x86_64-redhat-linux-gnu-library/4.1 #> [2] /usr/local/lib/R/library #> [3] /usr/lib64/R/library #> [4] /usr/share/R/library #> #> ────────────────────────────────────────────────────────────────────────────── ```
jhollist commented 2 years ago

Just pushed a fix. I was using my own homespun check for long lat. It didn't work that well! Switched to sf::st_is_longlat instead.

I have a few changes notched here so might push a fresh version to CRAN in a few days that will include this.

BTW, it is still on my list to switch to terra. I have most of the work done on the sf switch.

On Mon, Apr 25, 2022 at 5:47 AM Jakub Nowosad @.***> wrote:

Hi @jhollist https://github.com/jhollist! The issue is related to #66 https://github.com/jhollist/elevatr/issues/66. Providing non-longlat worked in the past, but currently returns an error. See a reprex (I am using the GitHub version of the package):

remotes::install_github("jhollist/elevatr")

library(elevatr)

library(terra)

> terra 1.5.21

library(sf)

> Linking to GEOS 3.9.2, GDAL 3.3.3, PROJ 8.2.1; sf_use_s2() is TRUE

zion = read_sf(system.file("vector/zion.gpkg", package = "spDataLarge")) el = get_elev_raster(zion, z = 8)

> Error in loc_check(locations, prj): The elevatr package requires longitude in a range from -180 to 180.

Created on 2022-04-25 by the reprex package https://reprex.tidyverse.org (v2.0.1) Session info

sessioninfo::session_info()

> ─ Session info ───────────────────────────────────────────────────────────────

> setting value

> version R version 4.1.3 (2022-03-10)

> os Fedora Linux 35 (Thirty Five)

> system x86_64, linux-gnu

> ui X11

> language (EN)

> collate en_US.UTF-8

> ctype en_US.UTF-8

> tz Europe/Warsaw

> date 2022-04-25

> pandoc 2.14.0.3 @ /usr/libexec/rstudio/bin/pandoc/ (via rmarkdown)

>

> ─ Packages ───────────────────────────────────────────────────────────────────

> package * version date (UTC) lib source

> assertthat 0.2.1 2019-03-21 [2] CRAN (R 4.1.1)

> class 7.3-20 2022-01-13 [2] CRAN (R 4.1.3)

> classInt 0.4-3 2020-04-07 [2] CRAN (R 4.1.1)

> cli 3.2.0 2022-02-14 [2] CRAN (R 4.1.2)

> codetools 0.2-18 2020-11-04 [2] CRAN (R 4.1.1)

> crayon 1.5.1 2022-03-26 [2] CRAN (R 4.1.2)

> DBI 1.1.2 2021-12-20 [2] CRAN (R 4.1.3)

> digest 0.6.29 2021-12-01 [2] CRAN (R 4.1.3)

> dplyr 1.0.8.9000 2022-04-05 [1] Github @.***)

> e1071 1.7-9 2021-09-16 [2] CRAN (R 4.1.1)

> elevatr * 0.4.2 2022-04-25 [1] Github @.***)

> ellipsis 0.3.2 2021-04-29 [2] CRAN (R 4.1.1)

> evaluate 0.15 2022-02-18 [2] CRAN (R 4.1.2)

> fansi 1.0.3 2022-03-24 [2] CRAN (R 4.1.2)

> fastmap 1.1.0 2021-01-25 [2] CRAN (R 4.1.1)

> fs 1.5.2 2021-12-08 [2] CRAN (R 4.1.2)

> generics 0.1.2 2022-01-31 [2] CRAN (R 4.1.2)

> glue 1.6.2 2022-02-24 [2] CRAN (R 4.1.2)

> highr 0.9 2021-04-16 [2] CRAN (R 4.1.1)

> htmltools 0.5.2 2021-08-25 [2] CRAN (R 4.1.1)

> KernSmooth 2.23-20 2021-05-03 [2] CRAN (R 4.1.1)

> knitr 1.38 2022-03-25 [2] CRAN (R 4.1.2)

> lattice 0.20-45 2021-09-22 [2] CRAN (R 4.1.1)

> lifecycle 1.0.1 2021-09-24 [2] CRAN (R 4.1.1)

> magrittr 2.0.3 2022-03-30 [2] CRAN (R 4.1.3)

> pillar 1.7.0 2022-02-01 [2] CRAN (R 4.1.2)

> pkgconfig 2.0.3 2019-09-22 [2] CRAN (R 4.1.1)

> progressr 0.10.0 2021-12-19 [2] CRAN (R 4.1.3)

> proxy 0.4-26 2021-06-07 [2] CRAN (R 4.1.1)

> purrr 0.3.4 2020-04-17 [2] CRAN (R 4.1.1)

> R.cache 0.15.0 2021-04-30 [2] CRAN (R 4.1.1)

> R.methodsS3 1.8.1 2020-08-26 [2] CRAN (R 4.1.1)

> R.oo 1.24.0 2020-08-26 [2] CRAN (R 4.1.1)

> R.utils 2.11.0 2021-09-26 [2] CRAN (R 4.1.1)

> R6 2.5.1 2021-08-19 [2] CRAN (R 4.1.1)

> Rcpp 1.0.8.3 2022-03-17 [2] CRAN (R 4.1.2)

> reprex 2.0.1 2021-08-05 [2] CRAN (R 4.1.1)

> rgdal 1.5-31 2022-04-18 [2] CRAN (R 4.1.3)

> rlang 1.0.2 2022-03-04 [2] CRAN (R 4.1.2)

> rmarkdown 2.13 2022-03-10 [2] CRAN (R 4.1.2)

> rstudioapi 0.13 2020-11-12 [2] CRAN (R 4.1.1)

> sessioninfo 1.2.2 2021-12-06 [2] CRAN (R 4.1.2)

> sf * 1.0-8 2022-04-07 [1] Github @.***)

> sp 1.4-7 2022-04-20 [2] CRAN (R 4.1.3)

> stringi 1.7.6 2021-11-29 [2] CRAN (R 4.1.3)

> stringr 1.4.0 2019-02-10 [2] CRAN (R 4.1.1)

> styler 1.7.0 2022-03-13 [2] CRAN (R 4.1.2)

> terra * 1.5-21 2022-02-17 [2] CRAN (R 4.1.2)

> tibble 3.1.6 2021-11-07 [2] CRAN (R 4.1.3)

> tidyselect 1.1.2 2022-02-21 [2] CRAN (R 4.1.3)

> units 0.8-0 2022-02-05 [2] CRAN (R 4.1.3)

> utf8 1.2.2 2021-07-24 [2] CRAN (R 4.1.1)

> vctrs 0.4.1 2022-04-13 [2] CRAN (R 4.1.3)

> withr 2.5.0 2022-03-03 [2] CRAN (R 4.1.2)

> xfun 0.30 2022-03-02 [2] CRAN (R 4.1.2)

> yaml 2.3.5 2022-02-21 [2] CRAN (R 4.1.2)

>

> [1] /home/jn/R/x86_64-redhat-linux-gnu-library/4.1

> [2] /usr/local/lib/R/library

> [3] /usr/lib64/R/library

> [4] /usr/share/R/library

>

> ──────────────────────────────────────────────────────────────────────────────

— Reply to this email directly, view it on GitHub https://github.com/jhollist/elevatr/issues/70, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJPYSYPAQF4U6TYERBYIADVGZS2VANCNFSM5UH75VAQ . You are receiving this because you were mentioned.Message ID: @.***>

-- Jeffrey W. Hollister email: @.*** cell: 401 556 4087 https://jwhollister.com

Nowosad commented 2 years ago

Thank you, Jeff.