Create a new plot of tile rectangles, or add to an existing plot.

plot_tiles(
  x,
  ...,
  add = FALSE,
  label = TRUE,
  cex = 0.6,
  add_coast = TRUE,
  include_zoom = TRUE
)

tiles_to_polygon(x)

Arguments

x

tiles as create by ceramic_tiles()

...

arguments passed to graphics::rect()

add

add to an existing plot?

label

include text label?

cex

relative size of text label if drawn (see text())

add_coast

include a basic coastline on the plot?

include_zoom

include zoom level with text label if drawn?

Value

plot_tiles() is called for its side-effect, a plot, and returns NULL invisibly. tiles_to_polygon returns a wk rct vector

Details

The extent ('xmin', 'xmax', 'ymin', 'ymax') is used directly to draw the tiles so must be in the native Mercator coordinate system used by most tile servers.

Examples

if (!is.null(get_api_key())) {
  get_tiles_zoom(zoom = 1)
  tiles <- ceramic_tiles(zoom = 1)
  plot_tiles(tiles)
}
#> Warning: no mapbox key found
#> 
#> To set your Mapbox API key obtain a key from https://account.mapbox.com/access-tokens/
#> 
#> 1) Run this to set for the session 'Sys.setenv(MAPBOX_API_KEY=<yourkey>)'
#> 
#> OR,
#> 
#> 2) To set permanently store 'MAPBOX_API_KEY=<yourkey>' in ~/.Renviron
#> 
#> See 'help(ceramic::get_api_key)'