Learn R Programming

cartography (version 1.3.0)

getTiles: Get Tiles from Open Map Servers

Description

Get map tiles based on a Spatial*DataFrame extent. Maps can be fetched from various open map servers.

Usage

getTiles(spdf, type = "osm", zoom = NULL, crop = FALSE)

Arguments

spdf
a Spatial*DataFrame with a valid projection attribute.
type
the tile server from which to get the map, one of "hikebike", "hotstyle", "lovinacycle", "lovinahike", "mapquestosm", "mapquestsat", "opencycle", "openpiste", "osm", "osmgrayscale", "osmtransport", "stamenbw", "stamenwatercolor", "thunderforestlandscape" and "thunderforestoutdoors".
zoom
the zoom level. If null, it is determined automatically (see Details).
crop
TRUE if results should be cropped to the specified spdf extent, FALSE otherwise.

Value

A RatserBrick is returned.

Details

Zoom levels are descibed on the OpenStreetMap wiki: http://wiki.openstreetmap.org/wiki/Zoom_levels.

See Also

tilesLayer

Examples

Run this code
## Not run: 
# 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)
# # Plot countries
# plot(spdf, add=TRUE)
# # Map tiles sources
# mtext(text = "Map data © OpenStreetMap contributors, under CC BY SA.",
#       side = 1, adj = 0, cex = 0.7, font = 3)
# ## End(Not run)

Run the code above in your browser using DataLab