[R-sig-Geo] spplot with two rasters

Dylan Beaudette dylan.beaudette at gmail.com
Wed Mar 5 19:14:49 CET 2008


On Wednesday 05 March 2008, Steve Friedman wrote:
> My two cents
>
> This sounds like a GIS type operation rather than an analytical process
> model that requires R. If so use ARC/INFO

Right-- this is just a plotting operation. The spplot function is very useful 
when working with data in R, and it would be nice to produce a "finished" 
figure within the context of the R session. Writing the data back to the GIS 
and finishing the map there works, but the operation cannot be eloquently 
contained within an R source file.

> Does the "context" raster provide data in the sense of quantitative needs
> or is it a categorical raster that shows classes of information such as
> land use?

the context raster is just an aerial image. I would like to overplot 
the "interesting" raster.

Dylan

> Now - would it make more sense to combine these using some kind of union
> process (I don't know how to do this in R) to show the quantitative raster
> data in the categorical classes. Then you can delete the larger context
> raster which does not contain any information and reduce the window
> (spatial extent) of the overlaid model.
>
> Steve
>
> On Wed, Mar 5, 2008 at 12:45 PM, Dylan Beaudette
> <dylan.beaudette at gmail.com>
>
> wrote:
> > On Tuesday 04 March 2008, Edzer Pebesma wrote:
> > > I find it hard to imagine how you want to plot two raster files on top
> > > of each other. Do you want some form of transparency? If it is just one
> > > overlaying the other, you could use overlay to find out which cells in
> > > raster 1 to replace with those in raster 2 before plotting.
> > > --
> > > Edzer
> >
> > Hi Edzer,
> >
> > I generally agree that plotting one raster file "over" another raster
> > file would be of little use. In this case, one of the raster files (the
> > interesting one) has been masked with nodata, such that it only really
> > covers
> > about 30% of the region of interest. The other raster is just contextual
> > data, and thus would be useful to plot "behind" the first raster.
> >
> > Ideas?
> >
> > Dylan
> >
> > > Dylan Beaudette wrote:
> > > > Hi,
> > > >
> > > > Is it possible to plot two raster images using spplot() in a manner
> > > > similar to:
> > > >
> > > > pts <- list("sp.points", points_file, pch = 4, col = "black",
> > > > cex=0.5) spplot(raster_file, zcol="elev.pred", sp.layout=list(pts))
> > > >
> > > > Note that one of the raster images is an aerial photo, used only for
> > > > context, while the second one is one with interesting z-values. The
> > > > second raster is masked and thus does not cover the entire region.
> > > >
> > > > Thanks,
> > > >
> > > > Dylan
> >
> > --

-- 
Dylan Beaudette
Soil Resource Laboratory
http://casoilresource.lawr.ucdavis.edu/
University of California at Davis
530.754.7341




More information about the R-sig-Geo mailing list