Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

genStaticMap

generates a "static map" from map tiles by "stitching" them together


Description

necssary because the Google static maps API requires a key now

Usage

genStaticMap(center, zoom = 15, size = c(640, 640), 


    destfile = tempfile("staticMap", fileext = ".png"), 


    type = c("google", "google-m", "google-s", "osm", 


        "osm-hot", "stamen-toner", "stamen-terrain", 


        "stamen-watercolor")[1], urlBase = "http://mt1.google.com/vt/lyrs=m", 


    tileDir = "/tmp/", tileExt = ".png", verbose = 0, 


    ...)

Arguments

center

optional center

zoom

zoom

size

size (in pixels) of "stitched" map

destfile

File to load the map image from or save to, depending on NEWMAP.

type

choice of tile server

urlBase

tileserver URL, alternatives would be "http://a.tile.openstreetmap.org/", "http://tile.stamen.com/toner/","http://tile.stamen.com/watercolor/"

tileDir

map tiles can be stored in a local directory, e.g. "~/mapTiles/Google/"

tileExt

image type of tile

verbose

level of verbosity

...

further arguments to be passed to FUN

Value

list with tiles

Author(s)

Markus Loecher

Examples

if (0){


  lat = c(40.702147,40.718217,40.711614);


  lon = c(-74.012318,-74.015794,-73.998284);


  center = c(mean(lat), mean(lon));


  zoom <- min(MaxZoom(range(lat), range(lon)));


  bb=qbbox(lat,lon)


  


  mt = GetMapTiles(latR =bb$latR , lonR=bb$lonR,zoom=zoom,verbose=1)


  PlotOnMapTiles(mt,lat=lat,lon=lon,pch=20,col=c('red', 'blue', 'green'),cex=2)


  


  mt = GetMapTiles(latR =bb$latR , lonR=bb$lonR,zoom=zoom,


                   tileDir= "~/mapTiles/Google/")


  PlotOnMapTiles(mt,lat=lat,lon=lon,pch=20,col=c('red', 'blue', 'green'),cex=2)


  


}

RgoogleMaps

Overlays on Static Maps

v1.4.5.3
GPL
Authors
Markus Loecher
Initial release
2020-02-12

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.