plotmap function

easy to use wrapper function

easy to use wrapper function

note the similarity in name to PBSmapping::plotMap This function is the workhorse of the package RgoogleMaps. It overlays plot on background image of map tile.

plotmap(lat, lon, map, zoom = NULL, API = c("google", "OSM", "bing", "google2")[1], maptype = c("roadmap", "mobile", "satellite", "terrain", "hybrid", "mapmaker-roadmap", "mapmaker-hybrid")[2], destfile, data, alpha = 1, col = 1, apiKey = NULL, verbose = 0, ...)

Arguments

  • lat: latitude values to be overlaid OR string to be geocoded OR named vector (lat,lon)!
  • lon: longitude values to be overlaid
  • map: optional map object
  • zoom: Google maps zoom level
  • API: choice of map tile API
  • maptype: defines the type of map to construct. There are several possible maptype values, including satellite, terrain, hybrid, and mobile.
  • destfile: File to save the map image to
  • data: data to look up variables in
  • alpha: opacity
  • col: plot color
  • apiKey: optional API key (allows for higher rate of downloads for Google); mandatory for Bing maps
  • verbose: level of verbosity
  • ...: further arguments to be passed to PlotOnStaticMap

Author(s)

Markus Loecher

Examples

if (0){ #####################Google maps############################# mapBG1 = plotmap("Brandenburg Gate, Berlin", zoom = 15) #####################bing maps############################# #for bing maps you will need your own API key, #sign up at https://msdn.microsoft.com/en-us/library/ff428642.aspx apiKey = scan("bingAPIkey.txt",what="") mapBG2 = plotmap("Brandenburg Gate, Berlin", zoom = 15, API = "bing", apiKey=apiKey) latlon <- cbind.data.frame(lat = c(38.898648,38.889112, 38.880940), lon = c(-77.037692, -77.050273, -77.03660)); map3 = plotmap(lat = latlon$lat, lon = latlon$lon, API = "bing", apiKey=apiKey, col = "purple", pch="X",cex=1.5) #####################OSM maps############################# map4 = plotmap(lat = latlon$lat, lon = latlon$lon, API = "OSM", zoom=15, col = "purple", pch="X",cex=1.5) }