1

How can one levelplota raster of say mean temperature on the hillshade provided by a DEM of the area of interest? Consider the example below (from Robert H):

library(raster)
library(rasterVis)
dem <- getData('alt', country='CHE')# get DEM for region of interest
slas <- slopeAspect(dem)#get slope and aspect
hill <- hillShade(slas[[1]], slas[[2]], 40, 270)# compute hillshade 

plot(hill, col=grey(0:100/100), legend=FALSE, main='Switzerland')
  • I like the hillshade because it shows clearly the hills and valleys etc.
  • Now given a raster of mean temperature for Switzerland, how can I overlay it on the hill just like plot(dem, col=rainbow(25, alpha=0.35), add=TRUE)? I am using levelplot function for my mapping.
  • The temperature data set can be obtained from climate <- getData('worldclim', var='bio', res=2.5) and then plot(climate$bio1, main="Annual Mean Temperature")

The desired output should look like the image below but temperature instead of DEM.

Any thoughts on this?

enter image description here

jgadoury
  • 293
  • 2
  • 13
code123
  • 2,082
  • 4
  • 30
  • 53
  • Why are you trying to plot over the DEM raster? You want the mean temperature to follow elevation contours? That sounds like downscaling to me. Your DEM has a resolution of 0.00833 deg while the temperature has a resolution of 0.04167 deg. Maybe `projectRaster` could help you. – jgadoury Sep 08 '16 at 19:25
  • @jgadoury I thought there was a way to overlay my raster on a google earth elevation map? Section `2.3. levelplots` under this link provides some hints https://rpubs.com/alobo/rasterOnGM. What I want to do is not downscaling but to overlay a raster on DEM with elevation differences clearly visible. – code123 Sep 08 '16 at 21:22
  • 2
    Maybe this is what you are looking for: [image](http://oscarperpinan.github.io/spacetime-vis/images/hillShading.png) and [code](https://github.com/oscarperpinan/spacetime-vis/blob/master/raster.R#L62) – Oscar Perpiñán Sep 15 '16 at 17:40
  • Great! Thanks @Oscar. Exactly what I was looking for. The legend doesn't plot if i plot hs before SSIav. Why this behavior? – code123 Sep 18 '16 at 07:39

0 Answers0