[R-sig-Geo] Overlaying rasters in spplot

Greg Snow Greg.Snow at imail.org
Tue Nov 29 19:15:10 CET 2011


This is not an answer to the spplot question, but if your main goal is to plot your own data on top of google map tiles, then you may want to consider using the RgoogleMaps package which does exactly that.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-sig-geo-bounces at r-project.org [mailto:r-sig-geo-bounces at r-
> project.org] On Behalf Of Chris Fowler
> Sent: Monday, November 28, 2011 5:55 PM
> To: r-sig-geo at r-project.org
> Subject: [R-sig-Geo] Overlaying rasters in spplot
> 
> I am still having trouble with some raster overlays.
> My trouble now is a result of my not really understanding how layers
> and sp.layout work in the spplot function
> 
> I go through a whole mess of steps to get two rasters of identical
> extent and dimension (One is a google map tile, the other my own data)
> Plotting them using the default plot() method within raster, however
> doesn't allow me to have the color palette and breaks I want, so at
> the suggestion of one of the threads on this list I have converted my
> raster objects to SpatialGridDataFrame objects.
> 
> I can plot these objects and get exactly what I want using the
> following code:
>   layer1<-
> spplot(raster1,"values",at=brks1,col.regions=pal1,colorkey=FALSE)
>   layer1
>   layer2<-spplot(raster2, "values", at=brks2,col.regions=pal2)
>   layer2
> 
> from reading the documentation on spplot() from sp package I should be
> able to use the sp.layout attribute to map the second of these layers
> with a transparency of say .5, but I have not been able to get there.
> 
> I am hoping that this is enough of a syntax question that the experts
> here can help without a full worked example--my apologies if this is
> not the case.
> 
> Thanks in advance,
> 
> Chris
> 
> Christopher S. Fowler PhD.
> 206.920.1686
> http://csfowler.com
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



More information about the R-sig-Geo mailing list