Learn R Programming

cartography (version 2.2.1)

tilesLayer: Plot Tiles from Open Map Servers

Description

Plot tiles from open map servers.

Usage

tilesLayer(x, add = FALSE)

Arguments

x

a RasterBrick object; the getTiles function outputs these objects.

add

whether to add the layer to an existing plot (TRUE) or not (FALSE).

See Also

getTiles

Examples

Run this code
# NOT RUN {
library(sf)
mtq <- st_read(system.file("gpkg/mtq.gpkg", package="cartography"))
# Download the tiles, extent = Martinique
mtqOSM <- getTiles(x = mtq, type = "osm", crop = TRUE)
# Plot the tiles
tilesLayer(mtqOSM)
# Plot countries
plot(st_geometry(mtq), add=TRUE)
txt <- "<U+00A9> OpenStreetMap contributors. Tiles style under CC BY-SA, www.openstreetmap.org/copyright"
mtext(text = txt, side = 1, adj = 0, cex = 0.7, font = 3)
# }

Run the code above in your browser using DataLab