Bastien--
I'm not sure what you need that isn't already available in the raster
package.  Have you looked at the ratify() function in raster?  It sets up a
RAT (raster attribute table) to make a raster object a factor, with
integers in the raster, which may be what you need.  I use it for thematic
(categorical or factor) NLCD land cover rasters.  Depending on the filetype
of your initial data, the readGDAL call implicit in raster() may accept a
parameter to read the file's RAT.  There also is a @legend slot for raster
objects, of class .RasterLegend.  However, it still might only do the color
mapping, not a complete legend.

As for Etienne's metadata question, I don't know that anyone can give an
answer without more information about what metadata is of concern, file
types, etc.  In my experience with a limited number of file types, readGDAL
& writeGDAL do a pretty good job of retaining whatever metadata were
included in the actual file.  If there is landsat-specific metadata, you
might look at Sarah Goslee's landsat package, although if I recall
correctly, it uses SpatialGridDataFrame objects, not raster classes.

I hope that this helps point you in a useful direction.

Tom 2

On Fri, Dec 6, 2013 at 5:42 AM, Bastien Ferland-Raymond <
Bastien.Ferland-Raymond@mrn.gouv.qc.ca> wrote:

> Hello Étienne,
>
> I'm a little disappointed nobody replied to your question, as this is
> something I'm also interested in.  The slot you are proposing to add
> metadata to raster* object could also be useful to allow categorical
> raster,
> something the raster package do not do.  I think it would be great to be
> able to use integer in the rasters values and than add in the metadata slot
> the key that specify the factors values (ex: 1=private land, 2=public land,
> etc.).  Having all that within the same R object would be a must.
>
> Bastien
>
>
>
>
> --
> View this message in context:
> http://r-sig-geo.2731867.n2.nabble.com/Attach-metadata-to-raster-object-tp7585254p7585290.html
> Sent from the R-sig-geo mailing list archive at Nabble.com.
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

	[[alternative HTML version deleted]]

