[gdal-dev] How to attach color tables to Tifs

Moses.Gone at t-systems.com Moses.Gone at t-systems.com
Mon Oct 14 02:00:18 PDT 2013


Hallo List,
In my tiling application am generating tiles with Gtiff as an output format. One of my inputs is of AIG format, however these inputs types comes with specific color tables, see sample below:

   0 255 255 255  # No-Data
   1   0   0 210  # Gewässer
   5   0   0 200  # Klärschlammbecken >> Wasser
  16 102 102 125  # Versiegelte Fläche
  20 102 102 125  # Brücken
  32 191 191   0  # Sand, Abbau
  33 191 191   0  # >> Sand, Abbau
  48 125  51   0  # Fels
  64 255 255   0  # Heide >> LaWi
  68 255 255   0  # Moor >> LaWi
  72 255 255   0  # Feuchtgebiete  >> LaWi
  80 255 255   0  # Landwirtschaft genutzte Fläche
  96 224 255   0  # Mischung Wald/Feld, Park
 100 255 180   0  # Weinbau
 101   0   0   0  # Gewächshaus
 102 140 255   0  # Obstbau
 112   0 125   0  # Wald, undifferenziert
 116  35 214   0  # Laubwald
 120   0 214  65  # Nadelwald
 176 255 100   0  # Vorstadt
 208 255  50   0  # Stadt, locker bebaut
 212 153 0  153   # Stadt, große Einzelgebäude
 224 255   0   0  # Stadt, dicht bebaut
 240 153  0    0  # Stadt, extrem dicht bebaut, Innenstädte
 241 153  0    0  # Stadt, extrem dicht bebaut, Industrieflächen >> 240


Now, what is the best way to attach this color table to my output tifs? BTW, my tifs are 8-bit(1-band) I read somewhere that I have to first convert my tif to vrt, then manually update the <ColorTable> section with entries for each color, like this:

  <ColorTable>
      <Entry c1="238" c2="238" c3="238" />
      <Entry c1="237" c2="237" c3="237" />
      <Entry c1="236" c2="236" c3="236" />
      <Entry c1="229" c2="229" c3="229" />
    </ColorTable>

Is this the right approach? Besides, I would like to automate the whole workflow. Is there a script that I can use to automate this workflow?


Thanks and regards

Moses

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20131014/db555ddc/attachment.html>


More information about the gdal-dev mailing list