[R-sig-Geo] Overlaying rasters in spplot

Edzer Pebesma edzer.pebesma at uni-muenster.de
Tue Nov 29 09:39:41 CET 2011



On 11/29/2011 01:54 AM, Chris Fowler wrote:
> 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.
> 

The spplot docomentation mentions which objects it can plot; objects of
type "trellis" (which layer1 and layer2 will be) are not among them.

> 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

-- 
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763  http://ifgi.uni-muenster.de
http://www.52north.org/geostatistics      e.pebesma at wwu.de



More information about the R-sig-Geo mailing list