USEPA / elevatr

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

error using `get_elev_raster()` #37

Closed tteo closed 4 years ago

tteo commented 4 years ago

Hi Jeff, I seem to have an issue downloading map tiles with the latest version (0.3.1). The code below works fine with 0.2.0.

raster::stack("https://prd-tnm.s3.amazonaws.com/StagedProducts/Maps/HistoricalTopo/GeoTIFF/TX/TX_Chisos%20Mountains_122109_1985_100000_geo.tif")-> map elevatr::get_elev_raster(raster(map), z = 9) -> dem

Am not sure if it's me but the specific error message is:

Error in (function (classes, fdef, mtable): unable to find an inherited method for function ‘spTransform’ for signature ‘"RasterLayer", "CRS"’

Thanks for the package!

Terence

jhollist commented 4 years ago

Let me take a look. I think I know what is going on.

jhollist commented 4 years ago

This should be good now.

Install the new version from Github:

remotes::install_gitub("jhollist/elevatr")

And then your example:

library(elevatr)
library(raster)

raster::stack("https://prd-tnm.s3.amazonaws.com/StagedProducts/Maps/HistoricalTopo/GeoTIFF/TX/TX_Chisos%20Mountains_122109_1985_100000_geo.tif")-> map
elevatr::get_elev_raster(raster(map), z = 9) -> dem

Should work! I'm assuming this is along the TX/Mexico border? Take a close look at the location and projections. I somewhat cavalierly changed how projections were getting handled. I think it still works!

Let me know if you run into any problems.

tteo commented 4 years ago

Perfect! Thanks for the quick response!

jhollist commented 4 years ago

Sounds like it is fixed. I'm going to close. Anymore issues, just open a new one.