PlotOnStaticMap {RgoogleMaps} | R Documentation |
This function is the workhorse of the package RgoogleMaps. It
PlotOnStaticMap(MyMap, lat, lon, destfile, zoom = NULL, size = c(640, 640), GRAYSCALE = FALSE, add = FALSE, FUN = points, verbose = 1, ...)
MyMap |
optional map object to be passed |
lat |
vector latitude values to be overlaid |
lon |
vector of longitude values to be overlaid |
destfile |
File to load the map image from or save to, depending on whether MyMap was passed. |
zoom |
Google maps zoom level. optional if MyMap is passed, required if not. |
size |
desired size of the map tile image. defaults to maximum size returned by the Gogle server, which is $640x640$ pixels. |
GRAYSCALE |
Boolean toggle; if TRUE the colored map tile is rendered into a black & white image, see RGB2GRAY |
add |
start a new plot or add to an existing |
FUN |
plotting function to use for overlay; typical choices would be points and lines |
verbose |
level of verbosity |
... |
further arguments to be passed to FUN |
NOte: To handle png file formats, you will need the package rgdal installed, for jpeg the package ReadImages.
the map object is returned via invisible(MyMap)
Credit for the implementation of the png file reading goes to both Gabor Grothendieck (http://www.mail-archive.com/r-sig-geo@stat.math.ethz.ch/msg04640.html) and Michael Sumner (http://finzi.psych.upenn.edu/R/Rhelp02a/archive/94605.html). Credit for the implementation of the jpg file reading goes to Greg Snow: https://stat.ethz.ch/pipermail/r-sig-geo/2009-March/005229.html
Markus Loecher, Sense Networks <markus@sensenetworks.com>
#The first step naturally will be to download a static map from the Google server. A simple example: ## Not run: GetMap(markers = '40.702147,-74.015794,blues%7C40.711614,-74.012318,greeng%7C40.718217,-73.998284,redc', destfile = "MyTile1.png"); ## Not run: tmp <- PlotOnStaticMap(lat = c(40.702147,40.711614,40.718217), lon = c(-74.015794,-74.012318,-73.998284), destfile = "MyTile1.png", cex=1.5,pch=20,col=c('red', 'blue', 'green'), add=F)