Wednesday, 4 December 2019

How to read a raster value table (VAT) in QGIS?



By default, QGIS does not seem to recognize "Value Tables" (VAT) the way ArcGIS does. So far I cannot find a way to represent the pixel values discretely, or apply a "legend" to the layer. Is there something that can be done to associate the VAT with the raster in QGIS? Ultimately I'd like to symbolize and see the joined values when I use the "Identify" tool on a pixel?


For example, I've downloaded a landcover GeoTIFF from the NRCS that contains a single "Pixel Value" field, which represents the type of landcover. In addition to the GeoTIFF, the authors included a "Value table" (.vat.dbf), which essentially is "joined" to the raster to give a plain English description of the "Pixel Value", as well as RGB values. There are 17 discrete values in the VAT, but a small sample looks like this:


Value   Count   Red Green   Blue    Land_Cover
0 299079 0.00000000000 0.00000000000 0.00000000000 Unclassified

11 3896533 0.27843137255 0.41960784314 0.62745098039 Open Water
12 86735 0.81960784314 0.86666666667 0.97647058824 Perennial Snow/Ice
21 4527275 0.86666666667 0.78823529412 0.78823529412 Developed, Open Space

This data can be downloaded from the "National Land Cover Dataset by State" at https://datagateway.nrcs.usda.gov/GDGHome_DirectDownLoad.aspx



Answer



In general, this appears to be a feature that is not available, I came across this QGIS, as of October 23, 2017, Feature request #14449, with still an open status and no resolution.



Many categorical raster datasets, such as those representing vegetation and landcover, have associated attribute tables. There are the usual value and count columns, but there are also often additional fields that hold useful vegetation descriptions. These might include vegetation type, vegetation complex, landcover type etc. ERDAS Imagine raster files will have a .vat.dbf with these attributes.


It would be incredibly useful to be able to open this attribute table as you can with a vector dataset. Then queries could be run and the corresponding cells highlighted. Additional columns could be added, and used to classify cells into new categories without having to do an r.recode or similar operation. For instance, you could assign weights this way, to prepare for site selection model.




But, I would try this approach, as reference here Displaying NLCD landcover data in QGIS with landcover class type?




  • Drop-down Render Type to "Singleband pseudocolor"

  • Drop-down Color and select one of the color ramps.

  • Click the "Classify" button

  • Click "Apply"




Additionally, these attribute columns could be made available to style the raster via the Categorized or Rule based renderers. For example, a vegetation dataset could be brought in and styled by the vegetation type attribute column. Or groups of vegetation/landcover types could be given a color with the Rule based renderer.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...