x <- readLines("https://earth-search.aws.element84.com/v1/search?limit=500&collections=sentinel-2-l2a&datetime=2023-10-20T00:00:00Z%2F..&bbox=100,-67,112,-62")
js <- jsonlite::fromJSON(x)
imred <- vapour::gdal_raster_data(js$features$assets$red$href[1], target_dim = c(1024, 0))
imblue <- vapour::gdal_raster_data(js$features$assets$blue$href[1], target_dim = c(1024, 0))
imgreen <- vapour::gdal_raster_data(js$features$assets$green$href[1], target_dim = c(1024, 0))
library(terra)
## me mangling the metadata from my vapour output, but it's just extent/dimension/crs
r <- rast(ext(attr(imred, "extent")), nrows = attr(imred, "dimension")[2], ncols = attr(imred, "dimension")[1], nlyrs = 3, vals = cbind(imred[[1]], imgreen[[1]], imblue[[1]]))
plot(terra::project(terra::vect(x), attr(imred, "projection")))
## terra automatically stretches the Int16 but I'm not sure how yet (how to decide the max?)
plotRGB(r, add = T)
Last active
October 27, 2023 06:33
-
-
Save mdsumner/5fb88b0eb437311eb7d8e1159d528f39 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
using new osgeo rocker: