
Writes rasters to PNG images and makes a KML code (ground overlays). Works with "RasterLayer"
and "RasterStack"
class objects. Target attributes can be specified using aesthetics arguments (e.g. "colour"
).
kml_layer.Raster(obj, subfolder.name = paste(class(obj)), plot.legend = TRUE,
metadata = NULL, raster_name,
png.width = ncol(obj), png.height = nrow(obj),
min.png.width = 800, TimeSpan.begin, TimeSpan.end,
layer.name, png.type, …)
object of class "RasterLayer"
, "SpatialPixelsDataFrame"
or "SpatialGridDataFrame"
character; optional subfolder name
logical; specify whether a map legend should be generated automatically
(optional) specify the metadata object
(optional) specify the output file name (PNG)
(optional) width of the PNG file
(optional) height of the PNG file
(optional) minimum width of the PNG file
object of class "POSIXct"
; (optional) begin of the sampling period
object of class "POSIXct"
; (optional) end of the sampling period
character; optional layer name
character; PNG type
additional aesthetics
arguments
Google Earth does not properly handle a 24-bit PNG file which has a single transparent color (read more at Google Earth Help). To force transparency, plotKML will try to set it using the -matte -transparent "\#FFFFFF"
option in the ImageMagick convert program (ImageMagick needs to be installed separately and located using plotKML.env()
). On some Unix run machines the png.type
argument has to be set manually to avoid producing empty PNGs.
kml-methods
, kml_open
, kml_layer.RasterBrick
, plotKML-method
# NOT RUN {
data(eberg_grid)
library(sp)
coordinates(eberg_grid) <- ~x+y
gridded(eberg_grid) <- TRUE
proj4string(eberg_grid) <- CRS("+init=epsg:31467")
data(SAGA_pal)
library(raster)
r <- raster(eberg_grid["TWISRT6"])
# }
# NOT RUN {
# KML plot with a single raster:
kml(r, colour_scale = SAGA_pal[[1]], colour = TWISRT6)
# }
Run the code above in your browser using DataLab