Learn R Programming

rosm (version 0.2.6)

rosm: Plot Raster Map Tiles From Open Street Map and Other Sources

Description

This package provides access and plots Open Street Map and Bing Maps tiles to create high-resolution basemaps and use hillshade tiles to add texture to other maps. Uses the 'sp' package to plot using base graphics. Plot Open Street Map derivative tiles using osm.plot, and plot Bing maps (Aerial, Labeled Aerial, Road) using bmaps.plot. 16 OSM and 3 Bing sources are included, with the ability to define custom tile sources based on OSM tilex, tiley, and zoom. Use osm.raster to get tiles in a RasterStack or write to disk (requires the 'raster' package.)

Arguments

Author

Dewey Dunnington <dewey@fishandwhistle.net>

References

Open Street Map tile servers, Bing Maps API documentation

Examples

Run this code
if (FALSE) { # identical(Sys.getenv("R_PRETTYMAPR_HAS_API_KEY"), "true")

# \donttest{
 library(prettymapr)

 # basic ploting
 nsbox <- searchbbox("nova scotia")
 osm.plot(nsbox)
 osm.plot(nsbox, type="stamenbw")
 bmaps.plot(nsbox)
 bmaps.plot(nsbox, type="Road")

 # use prettymapr to add scalebar and north arrow
 prettymap(osm.plot(nsbox))
 prettymap(bmaps.plot(nsbox, type="Road"))

 # define custom tile types in several ways

 # using string formats
 ts <- as.tile_source("http://a.basemaps.cartocdn.com/dark_all/${z}/${x}/${y}.png")
 osm.plot(nsbox, type=ts)

 # using string formats and register_tile_source
 register_tile_source(dark = "http://a.basemaps.cartocdn.com/dark_all/${z}/${x}/${y}.png")
 osm.plot(nsbox, type="dark")

 # set default plot type to something other than 'osm'
 set_default_tile_source("stamenbw")
 osm.plot(nsbox)

 # }
}

Run the code above in your browser using DataLab