[R] Сolor specification in KML() {raster} function

Антон Морковин a-morkovin at ya.ru
Sat Nov 1 16:31:35 CET 2014

Good morning,

I use raster package to process sattelite image maps. Could anyone help me with exporting data into KML? I have a raster image which I need to transfer into Google Maps. The colors of this image is described in raster at legend@colortable slot. Each color corresponds to raster cell values, so the color of a cell is raster at legend@colortable[cell.value+1]. 

All colors of my raster printed correctly by plot(), jpeg() or png() functions.

By default, KML() function uses standart color palettes but I need to save raster's own colors. I tried to set this colors into 'col' argument of KML() {raster} function. But in this case they are not displayed in a right way: so I can't understand which value of a raster cell correspond to a color. How to define the colors correctly? Thanks. 

Sincerely yours,
A.A. Morkovin

More information about the R-help mailing list