Great !

Thanks !

Patrick

Roger Bivand a écrit :
On Thu, 5 Aug 2010, Patrick Giraudoux wrote:

Hi,

I was wondering if it is possible to manage color transparency with image.SpatialGridDataFrame ? Eg to export png that could be imported into Google Earth in the way indicated in Bivand et al. pp 97-98 (functions kmlOverlay and GE_SpatialGrid of maptools). If yes how ?

NAs are set transparent by default (on output devices supporting transparency). Other values may be given an alpha of less than 1 - here a single value for all:

library(sp)
data(meuse.grid)
coordinates(meuse.grid) = c("x", "y")
gridded(meuse.grid) = TRUE
image(meuse.grid["dist"], col=heat.colors(12),
 main = "Distance to river Meuse")
image(meuse.grid["dist"], col=heat.colors(12, alpha=0.5),
 main = "Distance to river Meuse")

By setting the col= vector manually, it is possible to assign a different alpha value for each element, but it may be difficult to obtain a satisfactory visual impression consistently across output devices. See col2rgb() and rgb(). See also the colorspace package for a sophisticated treatment, and the use of hcl palettes, and the hsv() function. All of these can help in constructing a colour vector to pass to image.SpatialGridDataFrame().

Hope this helps,

Roger


Patrick

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo



_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to