as.tile_source: Tile Sources

Description Usage Arguments Details Value Examples

View source: R/0_tilespec.R

Description

Tile sources define where rosm looks for map tiles. There are a number of built-in types (osm.types), or they can be created using as.tile_source(), registered using register_tile_source for easy access, or passed directly to the osm.plot family of methods.

Usage

1
2
3
4
5
6
7
as.tile_source(x, ...)

is.tile_source(x)

source_from_url_format(url_format, max_zoom = tile.maxzoom.default(),
  min_zoom = 0, attribution = NULL,
  extension = tools::file_ext(url_format[1]), ...)

Arguments

x

An object (usually a name or string format) with which to create a tile source

...

Arguments passed to other methods

url_format

A string in the form https://tiles.wmflabs.org/bw-mapnik/${z}/${x}/${y}.png, where z, x, and y are the zoom, xtile, and ytile, respectively. Also valid is $q, which will be passed a quadkey.

max_zoom

An integer specifying the maximum zoom to use (default is 19)

min_zoom

An integer specifying the minimum zoom to use (default is 1)

attribution

An attribution string, required by some tile providers.

extension

An extension string, used to generate the cache file name and determine whether to use png or jpeg to read the cached file.

Details

Passing a name from osm.types will return that tile source; passing a name from register_tile_source will return that tile source, and passing a URL format in the form https://tiles.wmflabs.org/bw-mapnik/${z}/${x}/${y}.png will create a new tile source. Old style function names in the form tile.url.TYPE are still supported but are deprecated.

Value

An object of class 'tile_source'

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# get builtin tile sources
as.tile_source("osm")

# get custom tile sources
as.tile_source("http://a.basemaps.cartocdn.com/dark_all/${z}/${x}/${y}.png")

# get registered tile sources
register_tile_source(dark = "http://a.basemaps.cartocdn.com/dark_all/${z}/${x}/${y}.png")
as.tile_source("dark")

# create more complex tile sources using source_from_url_format
source_from_url_format("http://a.basemaps.cartocdn.com/dark_all/${z}/${x}/${y}.png",
                       attribution = "Tiles by CartoDB")

# test for tile sources
is.tile_source(as.tile_source("osm"))

paleolimbot/rosm documentation built on July 23, 2019, 7:35 a.m.