View source: R/addColorTable.R
addColorTable | R Documentation |
addColorTable()
creates a virtual raster file (.vrt
)
alongside a byte encoded raster that references the raster and includes
the color table. The .vrt
is a GDAL file that describes a
dataset to be composed of other datasets. it can be read directly by
some GIS software or can be passed to makeNiceTif()
or GDAL translate
directly to combine the data and color table in a single TIFF file.
addColorTable(x, table)
x |
The path to raster file containing categorical data, must be a single band byte encoded file. |
table |
a
|
Note: The color table will include all values between 0 and the maximum value in the raster. If your raster doesn't use some values in the sequence the missing values will appear in the key with white as the associated color and an empty string as the category label. Generally it works best if you recode your raster to have values 0 to N-1, or 1 to N.
The suggested workflow is:
addColorTable()
create .vrt
alongside existing TIFF
makeNiceTif()
called directly on the .vrt
to create a TIFF
with embedded color table, tiled data, stats, and overviews.
optionally call addVat()
to build a value attribute table.
addColorTable
creates a .vrt
file but returns nothing.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.