Returns the largest zoom level at which the tile resolution is still coarser than (or equal to) the native raster resolution. This is the zoom at which the data can be served without upsampling.

tile_zoom(
  dimension,
  extent,
  blocksize = c(256L, 256L),
  profile = c("mercator", "geodetic", "raster")
)

Arguments

dimension

integer `c(ncol, nrow)` of the source raster.

extent

numeric `c(xmin, xmax, ymin, ymax)` of the source raster. Must be in the coordinate system of the chosen `profile`.

blocksize

tile size in pixels, default `c(256L, 256L)`.

profile

one of `"mercator"`, `"geodetic"`, `"raster"`.

Value

integer zoom level.

Examples

tile_zoom(c(8194, 8194), c(140, 155, -45, -30), profile = "geodetic")
#> [1] 10