USEPA / elevatr

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

get_elev_raster #67

Open PM-deer opened 2 years ago

PM-deer commented 2 years ago

I have been using the function get_elev_raster to pull in a dem of my study site to look at habitat selection of mule deer. This was working until today and now I am getting this error code: Error in h(simpleError(msg, call)) : error in evaluating the argument 'CRSobj' in selecting a method for function 'spTransform': NA. I am not sure how to go about resolving this issue. Here is the code I am trying to run: tp.aoi <- read_sf(dsn = 'txdot_2015_county_detailed_tx.shp')

Pull just Brewster, however you can add to the list of counties to get more

tp.aoi <- tp.aoi[tp.aoi$CNTY_NM %in% c('Brewster'),]

Pull the DEM

Elevtr way

dem <- get_elev_raster(locations = tp.aoi, z = 11) Here is the shapefile: txdot_2015_county_detailed_tx.zip

jhollist commented 2 years ago

@PM-deer, first, apologies for the delay in getting back to you on this.

Your code runs fine on my machine. This error is usually a result of out of date packages. Make sure that sf, sp, rgdal, raster, and elevatr are all current. There have been a lot of changes and a lot of moving parts to keep track of WRT to how R now handles coordinate reference systems. So older packages may not work well with how I currently have elevatr set up.

PM-deer commented 2 years ago

I updated my packages to sf (1.0-6) sp (1.4-6), rgdal (1.5-28), raster (3.5-15), and elevatr (0.4.2) and I am still getting the same error code. Any Idea? Thanks