[R-sig-Geo] Overlaying time designated spatial points from a data frame to match the time of a raster image in a rasterStack
Navinder Singh
Navinder.Singh at slu.se
Wed Oct 22 23:57:23 CEST 2014
Hi,
I have a level plot with a number of rasters (monthly rasters for a year- generated with kind help from Oscar). Basically a raster stack.
I would like to overlay spatial points on this raster stack, but would like to overlay only those points that belong to the month matching the raster stack. For e.g. The points form January should fall on the raster from January, those from february should fall on February raster as so on. I am drowning in the lattice' literature but have not succeeded till now.
I am running the following code but not sure how to assign an index which can delegate the points from respective months to their rasters in the layer + sp. points argument from rasterVis package.
My data frame has the following columns:
df= X, Y, date (POSIXct), month (month.abb), id (animalID), SITE (a factor with origin area)
The rasters also have names in the format of month.abb.
And the code i am using is:
rrMean is a raster stack of monthly means. dfSp is a SpatialPointDataFrame with above fields.
p<-levelplot(rrMean, main="Mean Monthly NDVI (2010-2014)", par.settings=myTheme)
p+layer(sp.points(dfSp,col=dfSp$SITE))
# I understand that col argument just changes the colours but still plots all points on all rasters, but i guess i need something specified
in sp.points(dfSp,col=dfSp$SITE).
Thanks for any suggestions.
Best wishes,
Navinder
email: navinder.singh at slu.se<mailto:navinder.singh at slu.se>
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list