mercator_tile_extent: Tile extent

View source: R/georeference.R

mercator_tile_extentR Documentation

Tile extent

Description

Calculate tile extent for a given x, y tile at a zoom level.

Usage

mercator_tile_extent(tile_x, tile_y, zoom, tile_size = 256)

Arguments

tile_x

x coordinate of tile

tile_y

y coordinate of tile

zoom

zoo level

tile_size

tile dimensions (assumed square, i.e. 256x256)

Details

Currently only spherical Mercator is supported.

Value

A numeric vector of the spatial extent, in 'xmin', 'xmax', 'ymin', 'ymax' form.

Examples

mercator_tile_extent(2, 4, zoom = 10)

global <- mercator_tile_extent(0, 0, zoom = 0)
plot(NA, xlim = global[c("xmin", "xmax")], ylim = global[c("ymin", "ymax")])
rect_plot <- function(x) rect(x["xmin"], x["ymin"], x["xmax"], x["ymax"])
rect_plot(mercator_tile_extent(1, 1, zoom = 2))
rect_plot(mercator_tile_extent(2, 1, zoom = 2))
rect_plot(mercator_tile_extent(1, 2, zoom = 2))

rect_plot(mercator_tile_extent(1, 1, zoom = 4))
rect_plot(mercator_tile_extent(2, 1, zoom = 4))
rect_plot(mercator_tile_extent(1, 2, zoom = 4))

ceramic documentation built on June 22, 2024, 12:19 p.m.