Get extent from index values in VRT text, these are the individual footprints of raster windows in a VRT. These can be arbitrary to a specific grid, but generally are used for tiled mosaics.
extent_vrt(x)
a matrix of 4 columns, xmin,xmax,ymin,ymax
Each VRT raster element records it's relative position within the grid, so we grid logic to expand the actual extent of each element, and return those as a matrix of xmin,xmax,ymin,ymax.
#src <- "https://opentopography.s3.sdsc.edu/raster/NASADEM/NASADEM_be.vrt"
src <- gzfile(system.file("extdata/NASADEM_be.vrt.gz", package = "vaster"), "rt")
## read VRT from a URL or file (we use a connection here to keep package example small)
l <- base::readLines(src)
ex <- extent_vrt(src)
#> Error in strsplit(unlist(lapply(strsplit(vrt1, "DstRect xOff=\""), "[", 2)), "\" yOff"): non-character argument
close(src)
plot_extent(ex)
#> Error: object 'ex' not found