[R-sig-Geo] gdal color tables

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Sun Dec 23 22:25:31 CET 2012


On Sun, Dec 23, 2012 at 8:23 PM, Roger Bivand <Roger.Bivand at nhh.no> wrote:

> There is no support in raster or sp objects for symbology, and unless
> someone extends the classes to accommodate symbology on a dynamic
> by-attribute basis, it isn't going to happen.
>

 I'm not sure that's true - I can read in a raster from a geoTIFF and
get a colour table from it, then plot will show it with the right
colours - here's a Land Use tiff:

> lu
class       : RasterLayer
dimensions  : 397, 413, 163961  (nrow, ncol, ncell)
resolution  : 100, 100  (x, y)
extent      : 3356200, 3397500, 3533200, 3572900  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000
+ellps=GRS80 +units=m +no_defs
data source : /data/rowlings/MapLibrary/Europe/UK/IsleOfMan/iomcorine.tiff
names       : iomcorine
values      : 0, 255  (min, max)

> lu at legend@colortable[1:10]
 [1] "#000000" "#E6004D" "#FF0000" "#CC4DF2" "#CC0000" "#E6CCCC" "#E6CCE6"
 [8] "#A600CC" "#A64D00" "#FF4DFF"


 Support for this is minimal in package:raster, and I think what Agus
is trying to do (correct me if wrong) is create a raster with a colour
table such as this from R. If I just use writeRaster I get a numeric
raster with no palette.

I think Robert has talked about better support for paletted rasters in the past.

Barry



More information about the R-sig-Geo mailing list