[R-sig-Geo] Overlaying time designated spatial points from a data frame to match the time of a raster image in a rasterStack

Oscar Perpiñán Lamigueiro oscar.perpinan at upm.es
Thu Oct 23 10:47:12 CEST 2014


Hi,

> Works great Frede. Didn’t think that xyplot could just be overlaid
> like this on a raster stack. Got carried away by the example Oscar has
> in the rasterVis tutorial, where "sp. points" is used within a layer.

With the latticeExtra::+.trellis function you can overlay trellis
objects. You have to use the latticeExtra::layer function if you need a
function that don't produce a complete trellis object such as panel.text
or sp.points.

Yet another way to get what Frede posted. Here I am using sampleRandom
to sample the RasterStack and get a list of SpatialPointsDataFrame. With
latticeExtra::xyplot.list and sp::spplot you print this list.

sPoints <- lapply(1:12, FUN = function(i) sampleRandom(rr.mean[[i]],
                            size = 10, sp = TRUE))

levelplot(rr.mean) + xyplot.list(sPoints, FUN = spplot, pch = 13, col.regions = 'black')

Best,

Oscar.
-- 
Oscar Perpiñán Lamigueiro
Dpto. Ingeniería Eléctrica (ETSIDI-UPM)
Grupo de Sistemas Fotovoltaicos (IES-UPM)
URL: http://oscarperpinan.github.io



More information about the R-sig-Geo mailing list