USEPA / elevatr

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

loc_check fails on SpatVector #91

Open courtiol opened 1 year ago

courtiol commented 1 year ago

There is a small issue in the code of loc_check:

https://github.com/jhollist/elevatr/blob/7b11c909df8838a93aaabfc3f247a804e91a5fdd/R/internal.R#L70

values = FALSE does not work with SpatVector.

Example:

packageVersion("terra")
#> [1] '1.7.46'
packageVersion("rnaturalearth")
#> [1] '0.3.4'
oceans_sf <- rnaturalearth::ne_download(category = "physical", scale = "small",
                                        type = "ocean", returnclass = "sf")
#> The legacy packages maptools, rgdal, and rgeos, underpinning the sp package,
#> which was just loaded, were retired in October 2023.
#> Please refer to R-spatial evolution reports for details, especially
#> https://r-spatial.org/r/2023/05/15/evolution4.html.
#> It may be desirable to make the sf package available;
#> package maintainers should consider adding sf to Suggests:.

oceans_terra <- terra::vect(oceans_sf)
oceans_terra <- terra::project(oceans_terra, "EPSG:32662")

worldelev_raster <- elevatr::get_elev_raster(locations = oceans_terra, z = 1)
#> Error in .local(x, ...): unused argument (values = FALSE)

Created on 2023-10-09 with reprex v2.0.2