Create png or jpeg tiles from any GDAL DSN in slippy map format, this consists of zoom level directories: 0/, 1/, 2/, etc that contain similar column diretories with row files in them. The format is "z/x/y.png" with combinations of z = 0:maxzoom, x = 0:maxrow, y = 0:maxcol. Not every possible combination will exist, only those that represent the data as input will be generated.

gdal_tiles(
  dsn,
  zoom = NULL,
  blocksize = 256L,
  profile = "mercator",
  output_dir = tempfile(),
  overwrite = FALSE,
  update = FALSE,
  dry_run = TRUE,
  xyz = FALSE,
  format = c("png", "jpeg"),
  write_html = TRUE,
  minmaxzoom = NA,
  title = "",
  copyright = "copyright ..."
)

Arguments

dsn

input dataset, file path, VRT string, or any DSN GDAL can open and warp from

zoom

zooms to render, can be a single number multiple (from 0:23)

blocksize

size of tiles, defaults to 256

profile

domain to use, 'mercator', 'geodetic' (longlat), or 'raster'

output_dir

directory to write to, by default a tempdir is used

overwrite

clobber the output directory, delete it entirely if TRUE, FALSE is the default

update

if TRUE do not create tiles if they already exist, FALSE by default and irrelevant if overwrite=TRUE

dry_run

if TRUE only the scheme is built and returned as a data frame

xyz

the row orientation default FALSE means row zero is at the bottom (TMS style), if TRUE the zero row is at the top (XYZ style)

format

'png' or 'jpeg'

write_html

TRUE by default, writes HTML index see Details

minmaxzoom

optional, two values to set the html index range independently of the rendered levels

title

title for HTML output

copyright statement for HTML output

Value

the tile scheme, invisibly as a dataframe

Details

Currently we write a leaflet.html by default. Note that if you run with 'update' with a different set of zooms in a previous run then the html will be overridden by a different min and/or max zoom setting. The zoom range can be set independently of the generated or existing tiles by using minmaxzoom.

Examples

dsn <- system.file("extdata/gebco_ovr5.vrt", package = "filearchy", mustWork = TRUE)
## parallelize here
#future::plan(multicore)
tiles <- gdal_tiles(dsn, dry_run = TRUE)
if (!interactive()) unlink(tiles$path)
#> Warning: Unknown or uninitialised column: `path`.
#future::plan(sequential)