addVat: Create a VAT for a raster file

View source: R/addVat.R

addVatR Documentation

Create a VAT for a raster file

Description

This function creates a new sidecar file next to x which contains a value attribute table (VAT). A VAT is used by ESRI GIS software to encode additional information about each value in a classified integer raster.

Usage

addVat(x, attributes, skipCount = FALSE)

Arguments

x

the path to a geoTIFF file; use with other raster formats is untested.

attributes

a data.frame with a column VALUE (case insensitive) along with any other data that should be added to the VAT. Column names should not contain periods and are limited to 11 characters.

skipCount

if TRUE then this function will assume that all values in the grid are represented in attributes and will not calculate the frequency of each class. This speeds things up tremendously but means the VAT will not have a COUNT field. In tests these files display in ArcGIS and allow for identification of cells and their attributes; but it does not conform to ESRI's apparent standard of having both VALUE and COUNT in a VAT.

Details

It calls terra::freq() to generate a table of values and frequencies from the raster x which can take a long time for large files. It should only be called on integer encoded files.

A VAT is a a dbf file with "VALUE" and "COUNT" fields containing all the unique values and their associated frequency in the raster file. The VAT file's name will be the name of the image file with ".vat.dbf" appended; for a tif this means the file will end in ".tif.vat.dbf". The column names in a .dbf file are restricted to 11 characters and cannot contain periods; for detailed limitations see foreign::write.dbf() which is used to write the VAT.

Value

This function creates a VAT file but returns nothing.


ethanplunkett/rasterPrep documentation built on Sept. 17, 2024, 1:05 p.m.