In my previous email, I laid out a process that seems to work for me.
Now I realize that while this works for a single input file, how do I
generalize it to work on a set of tiles?
At first I naively thought I could just replace the SourceFileName and
re-run the gdal_translate -of gtiff step, but since the location is
embedded in the vrt, every tile would end up in the same place.
How do I generalize this process so I can reuse the edits to the .vrt?
On 4/23/2013 3:20 PM, David Strip wrote:
From Even's advice, I was able to piece together this workflow.
Given an input geotiff image.gtif
gdaltranslate -of image.gtif image.vrt
Then open image.vrt in a text editor and look for the color table by
searching for the tag <ColorTable> (actually you probably don't need
to search, it's near the top)
Replace the contents of the color palette with the palette entries you
want on output.
Then below the color table look for <SimpleSource> and replace it with
<ComplexSource>
Look for </SimpleSource> and replace with <ComplexSource>
Add a new line above </ComplexSource> that looks like
<LUT>input_color_index:output_color_index,
input_color_index:output_color_index, ... </LUT>
for example if you want to map input palette entry 1 to output entry
10, input 3, to output 5, ...
<LUT>1:10, 3:5, ...<LUT>
You will need to map EVERY input color that occurs in your image to an
output color or else gdal_translate will interpolate a color for you,
and you don't want that.
Now that you've edited the file run
gdal_translate -of gtiff image.vrt mapped_image.gtif
And you're done.
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev