lazyraster
lazyraster copied to clipboard
allow warping to a raster, not just specify a dim
seems to work ok, except for we auto-get raw values from imagery ... so have forced use of Float64 for now.
target <- raster::raster(raster::extent(c(-1, 1, -1, 1) * 1e6), crs = "+proj=laea +lon_0=147 +lat_0=-42", nrows = 512, ncols = 512)
sstfile <- system.file("extdata/sst.tif", package = "vapour")
library(lazyraster)
library(raster)
#> Loading required package: sp
plot(as_raster(lazyraster(sstfile), target))

plot(as_raster(lazyraster(sstfile)), c(128, 256))

vearth <- '<GDAL_WMS> <Service name="VirtualEarth">
<ServerUrl>http://a${server_num}.ortho.tiles.virtualearth.net/tiles/a${quadkey}.jpeg?g=90</ServerUrl></Service>
<MaxConnections>4</MaxConnections> <Cache/> </GDAL_WMS>'
plotRGB(as_raster(lazyraster(vearth), target, band = 1:3))

plotRGB(as_raster(crop(lazyraster(vearth), extent(14e6, 20e6, -4e6, -0e6)), c(64, 64), band = 1:3))

Created on 2021-09-07 by the reprex package (v2.0.1)