Convert GDAL VRT mosaics to the GDAL Tile Index (GTI) format.
# install.packages("pak")
pak::pak("hypertidy/vrgti")
library(vrgti)
# Convert a VRT mosaic to a GTI-compatible GeoPackage
vrt_to_gti(
dsn = "/vsicurl/https://raw.githubusercontent.com/mdsumner/rema-ovr/main/REMA-2m_dem_ovr.vrt",
output = "rema_tiles.gpkg"
)
# Open the result as a raster dataset
library(gdalraster)
ds <- new(GDALRaster, "GTI:rema_tiles.gpkg")
ds$dim()
ds$res()
ds$close()Let’s try that example output directly:
dsn <- "/vsicurl/https://github.com/mdsumner/vrgti/releases/download/latest/rema_v2_tiles.gti.gpkg"
library(gdalraster)
#> GDAL 3.13.0dev-7924dc998e (released 2026-01-27), GEOS 3.12.1, PROJ 9.7.0
ds <- new(GDALRaster, dsn)
ds$getDriverLongName()
#> [1] "GDAL Raster Tile Index"
ds$dim()
#> [1] 2725100 2921100 1
ds$res()
#> [1] 2 2
ds$bbox() ## xmin,ymin,xmax,ymax
#> [1] -2700100 -2500100 2750100 3342100
ds$close()SimpleSource elements, consistent across bands, no resamplingGDALVector, with polygon footprints, a location field, and layer metadata (RESX, RESY, extent, band count, data type, nodata, SRS)GTI is an improved mosaic format over VRT for large tile collections:
The function will stop with a diagnostic message if the VRT contains:
AveragedSource, KernelFilteredSource, or other non-simple source types (note: ComplexSource is allowed — it’s the standard nodata-aware mosaic source)VRTWarpedDataset or VRTDerivedRasterBand subclassesGDALVector and layer metadataPlease note that the vrgti project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.