0

Landsat-derived Annual Dominant Land Cover Across ABoVE Core Domain is composite tiled classified imagery dataset covering the years 1984-2014. The format is elegant and clever but hard to use. Each tile file is a 31-band GeoTIFF, with each band providing one year of data for the period (band_1 = 1984, ...band_31 = 2014) and classified into 15 values (1-15 in integer).

Above image shown with standard colour palette

Neither ArcGIS or Qgis can use the data very well out of the box as they only allow colour maps and/or attributes for single channel 8 bit rasters. We could explode the bands into distinct files, but for my area of interest that will yield 175*31=5,425 files. A management headache to say the least, and probably file-system performance limit as well not to mention the increase in storage needs.

Arc Pro raster properties window for a single band

My intuition says both Arc and Qgis (via gdal) have the necessary features to be able to effectively use these imagery in place via raster with function chains (arc) and virtual raster tables with pixel functions (gdal, and arc to lesser degree). I have so far though not managed to figure out the necessary magic.

The end goal is to enable people to load a given year from the data source and have it displayed in the standard colour map. Ideally it also yield the corresponding code when interrogated in ArcMap/Pro or Qgis. It should also be straightforward to use an arbitraty year as input to a geoprocessing tool. All with the least amount of fuss and hairpulling. ;-)

I would prefer a single solution that can serve both ArcGIS and Qgis but as requested I'm splitting this into a separate question for each platform. This is the Qgis posting. The ArcGIS posting is here.

I'm going to self-answer with the best I've come up with so far for mosaic solutions, but they're just partial steps along the way and I'm not happy with them. Please feel free to improve or better.

0

Virtual Raster Table experiments.

Single year from a single tile

This solves extracting a single band from a single file and applying a colour map with names. It does not address mosaicking. The result can be read in Qgis as well as ArcMap & Pro.

Create vrt's for each band (Windows CMD):

for /L %a in (1,1,31) do gdal_translate -b %a -colorinterp gray ..\xxx.tif %a.vrt
rename 1.vrt 1984.vrt
rename 2.vrt 1985.vrt
...

To change from greyscale to colour map in a smart text editor search and replace

  • all occurances of gray with palette,
  • band="1"> with categorynames and
  • colortable xml snippets
    <ColorInterp>Palette</ColorInterp>
    <VRTRasterBand dataType="Byte" band="1" description="1984">
    <CategoryNames>
      <Category>n/a</Category>
      <Category>Evergreen Forest</Category>
      <Category>Deciduous Forest</Category>
      <Category>Mixed Forest</Category>
      <Category>Woodland</Category>
      <Category>Low Shrub</Category>
      <Category>Tall Shrub</Category>
      <Category>Open Shrubs</Category>
      <Category>Herbaceous</Category>
      <Category>Tussock Tundra</Category>
      <Category>Sparsely Vegetated</Category>
      <Category>Fen</Category>
      <Category>Bog</Category>
      <Category>Shallows/littoral</Category>
      <Category>Barren</Category>
      <Category>Water</Category>
    </CategoryNames>
    <ColorTable>
      <entry c1="0" c2="0" c3="0" />
      <entry c1="0" c2="102" c3="0" />
      <entry c1="0" c2="178" c3="0" />
      <entry c1="0" c2="140" c3="0" />
      <entry c1="50" c2="102" c3="0" />
      <entry c1="102" c2="102" c3="0" />
      <entry c1="140" c2="140" c3="0" />
      <entry c1="178" c2="178" c3="0" />
      <entry c1="229" c2="204" c3="153" />
      <entry c1="150" c2="150" c3="100" />
      <entry c1="225" c2="204" c3="0" />
      <entry c1="128" c2="255" c3="204" />
      <entry c1="233" c2="255" c3="190" />
      <entry c1="1" c2="255" c3="255" />
      <entry c1="178" c2="178" c3="178" />
      <entry c1="0" c2="0" c3="255" />
    </ColorTable>
1
  • Powershell regular expression to search and replace description="xxxxx" with the band name: (findstr /i 'band=' *.vrt) -replace '(^....)\.vrt(.*)="xxxxx"(.*)', '$1.vrt$2="$1"$3'. Still doesn't edit the file in place though. – matt wilkie Jan 26 at 22:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.