0

I want to plot my RGB raster on a basemap in R.

So far I have a RasterStack object and I have downloaded the basemap with ggmap. I can plot them individually but not together.

stack_rrs <- stack(red4, green3, blue2)
plotRGB(stack_rrs,r=1,g=2,b=3, stretch = "lin")
bm <- ggmap(get_map(location = "Location", maptype = "satellite"))
  • Does inset_raster(stack_rrs, xmin, xmax, ymin, ymax, interpolate = TRUE) work? – Kazuhito Oct 6 '17 at 9:01
  • 1
    In case a interactive map is fine, you can use mapview::viewRGB – TimSalabim Oct 6 '17 at 9:53
  • when I use inset_raster, i get this error: Error in UseMethod("as.raster") : no applicable method for 'as.raster' applied to an object of class "c('RasterStack', 'Raster', 'RasterStackBrick', 'BasicRaster')" – dtanon Oct 6 '17 at 11:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.