osmap | R Documentation |
osmap
fetches and draws OpenStreetMap tiles (or any compatible
tiles) in the current graphics device assuming latitude and longitude
coordinates.
osmap(alpha = 1, zoom, area = par()$usr, tiles.url, cache.dir, tile.coord = FALSE)
alpha |
in theory this is the desired opacity of the map but in practice the final plot is faded to white by this alpha value (1 = no fading, 0 = entriely white) |
zoom |
zoom level of the map to draw (optional). If missing the zoom level is determined automatically to cover the area with about five tiles in the horizontal direction |
area |
minimal area to cover - the required tiles are computed to cover at least this area |
tiles.url |
URL to the tiles server (excluding the
|
cache.dir |
if set, the tiles are first looked up in this directory and the directory is used for caching downloaded tiles |
tile.coord |
if |
par(mar=rep(0,4)) # plot any lat/lon data - here just an area around the AT&T Labs plot(c(-74.44, -74.39), c(40.76, 40.79), type='n') # draw the map (needs internet connection to get the tiles) osmap() # to draw the world, use zoom level=0 as the base so that # the area is simply [0,1] plot(c(0,1), c(0,1), type='n') osmap(tile.coord=0L)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.