Why does terra take forever (or never complete ...)?
## remotes::install_github("hypertidy/gdalio")
library(gdalio)
## warp target
extent <- c(-2e5, 2.4e5, -2e5, 2.84e5)
dimension <- c(1024, 1024)
projection <- "+proj=lcc +lon_0=146 +lat_0=-42 +lat_1=-40 +lat_0=-44 +datum=WGS84"
target <- terra::rast(terra::ext(extent), nrows = dimension[2], ncols = dimension[1], crs = projection)
gdalio_set_default_grid(target)
img_src <- "WMTS:https://services.thelist.tas.gov.au/arcgis/rest/services/Basemaps/Topographic/MapServer/WMTS/1.0.0/WMTSCapabilities.xml,layer=Basemaps_Topographic,tilematrixset=default028mm"
## source data
terr <- terra::rast(img_src)
source(system.file("raster_format/raster_format.codeR", package = "gdalio", mustWork = TRUE))
## these should do exactly the same tasks through GDAL warper, but terra doesn't complete
v <- gdalio_terra(img_src, bands = 1:3, band_output_type = "Int32"); terra::plotRGB(v)
## why does this not complete ... don't run it, trust me it takes way too long and probably never finish
#terr <- terra::project(terr, target)
It does work well for an online GeoTIFF with overviews, so perhaps the COG driver does more for the auto-selection of the right zoon than the WMTS driver does. The GDAL WARP app lib does this well, for any driver - and I think terra might not use that.
update
add the zoom_level explicitly to the DSN and terra works (so the COG/GTiff driver is automatically selecting the right overview, and the way vapour/gdalio uses the warper already does this for other drivers)