# NOT RUN {
library(sp)
data("nuts2006")
# extract Denmark
spdf <- nuts0.spdf[nuts0.spdf$id=="DK",]
# Download the tiles, extent = Denmark
den <- getTiles(spdf = spdf, type = "osm", crop = TRUE)
class(den)
# Plot the tiles
tilesLayer(den)
library(sf)
mtq <- st_read(system.file("shape/martinique.shp", 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)
# Map tiles sources
mtext(text = "Map data <U+00A9> OpenStreetMap contributors, under CC BY SA.",
side = 1, adj = 0, cex = 0.7, font = 3)
# }
Run the code above in your browser using DataLab