[gdal-dev] palette file format doc ?
Even Rouault
even.rouault at spatialys.com
Wed Mar 20 13:52:29 PDT 2024
Michael,
Le 20/03/2024 à 21:38, Michael Sumner via gdal-dev a écrit :
> Is the palette_file .txt format documented?
>
> https://gdal.org/programs/gdalattachpct.html
>
> It's mentioned in a few utilities, and created by tests but I couldn't
> find an existing example or a description (I guessed, incorrectly at
> first, leaving out the index column). I
The initial attachpct.py script only worked with a GDAL raster as the
source for the palette. The support for text formats, or qml, qlr seems
to be a later addition by Idan Miara, and the best doc is probably the
code:
https://github.com/OSGeo/gdal/blob/master/swig/python/gdal-utils/osgeo_utils/auxiliary/color_palette.py
. You may also have a look at autotest/pyscripts/test_gdal_utils.py
which has tests for this color palette reading code. Looking a bit at
it, I suspect the GDAL text format refered is the one actually used by
gdaldem color-relief:
https://gdal.org/programs/gdaldem.html#color-relief , which is itself
derived from the one used by GRASS r.colors . But the Python code (only
Python) and the one used by gdaldem (only C++) are different, so I
wouldn't exclude there might be some differences.
| take it that it is 0-255 range values, but is index 0-based or 1?
0-based, as (unsigned) raster values are
> And, can index be *value* in any contexts?
If you use a raster with a signed data type, that could be negative
values (assuming I understand your question)
Even
--
http://www.spatialys.com
My software is free, but my time generally not.
More information about the gdal-dev
mailing list