Hi Evert,

As the help file says, the image is produced by the 'image' function, so
have a look at the help of that function. I think you can use the breaks
argument, perhaps using many more breaks than I do in the example below:

library(raster)

r <- raster(nc=10, nr=10)
r[] = runif(100) * 3
r[20:35] = NA
r[40:60] = -999

image(r, col=c('grey', rainbow(3)), breaks=c(-1000, 0, 1, 2, 3))

KML(r, 'test.kmz', col=c('grey', rainbow(3)), breaks=c(-1000, 0, 1, 2, 3))


Cheers, Robert


On Fri, Jun 1, 2012 at 8:36 AM, Thomas, Evert (Bioversity-Colombia) <
E.Thomas@cgiar.org> wrote:

> Dear all,
>
> I have a raster file in which cells have either values of -999, or values
> ranging from 0-3 (apart from NA values obviously). I want to make a KML
> file from this raster in which I would  like cells with values -999 to be
> displayed in gray and cells with values from 1-3 be colored according to a
> chosen color gradient (eg yellow to red).
>
> Is there a way to do this directly in the KML function of Raster package,
> or should I explore alternative ways to go about this?
>
> many thanks for any suggestions you might have!
>
> cheers Evert
>
>        [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

	[[alternative HTML version deleted]]

