ropensci / rnaturalearth

An R package to hold and facilitate interaction with natural earth map data :earth_africa:
http://ropensci.github.io/rnaturalearth/
Other
214 stars 24 forks source link

Directory issue for rasters #52

Closed jstagge closed 7 months ago

jstagge commented 2 years ago

ne_download() downloads the raster properly and unzips, but when reading in the file, the path adds an extra file name.

This pull request deletes the file name. It runs properly on my test code:

require(tidyverse) library(rnaturalearth) require(stars) require(sf)

background_orig <- ne_download(scale = 10, type = 'HYP_LR_SR_W_DR', category = 'raster')

bb = st_bbox(c(xmin = -115, ymin = 25, xmax = -100, ymax = 50), crs = st_crs(background_orig)) background <- st_as_stars(background_orig, proxy= FALSE) %>% st_crop(bb) %>%st_rgb(3)

plot(background)