-
Notifications
You must be signed in to change notification settings - Fork 37
Description
Just extending discussion from #9 to be its own issue.
The idea is to delay any action involving the original raster object until there is a known height, width, and target resolution, so that large rasters can be passed to annotation_spatial.Raster()
without fear of taking forever to render.
Question for @mdsumner: What is the series of events that usually takes place during this operation? I had been thinking something like:
target_res <- calculate_target_res(bounds, height, width, dpi)
st_make_grid(plot_bounds, cellsize = target_res) %>%
st_transform(raster_crs) %>%
raster::extract(raster, .) %>%
make_a_raster_grob()
...but maybe it's a bad idea to reverse project a grid from the coord_sf()
CRS to the raster CRS and resample that way? The other option would be to raster::projectRaster() %>% raster::resample()
? Or maybe you've solved this in the hypertidy/lazyraster package?
Would also be nice to apply this to a rasterGrob()
somehow, since these also take forever to render?