Add image plot to RgoogleMaps plot

823 views Asked by At

I'm trying to add an image plot to PlotOnStaticMaps plot (RgoogleMaps) but I failed. Here's my code:

PlotOnStaticMap(Map, add = FALSE, TrueProj=F,  FUN = points)  # background plot

image(X,Y,evalmat,col=heat.colors(100, alpha=0.7), add = TRUE)

contour(X,Y,evalmat,add=TRUE)

How could I fix it? I know that it is possible, because it has been used but now it doesn't work...

1

There are 1 answers

1
Verma On

PlotOnStaticMap is used like this:

PlotOnStaticMap(MyMap, lat, lon, destfile, zoom = NULL, size = c(640, 
640), GRAYSCALE =    FALSE, add = FALSE, FUN = points, mar = c(0,
 0, 0, 0), NEWMAP = TRUE, TrueProj = TRUE, axes = FALSE, verbose = 0, ...)

MyMap = optional map object

lat = latitude values to be overlaid

lon = 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 Google 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

mar = outer margin in plot; if you want to see axes, change the default NEWMAP = load map from file or get it "new" from the static map server

TrueProj = set to FALSE if you are willing to accept some degree of inaccuracy in the mapping. In that case, the coordinates of the image are in lat/lon and the user can simply overly points/lines/axis without worrying about projections