*.colors.out: simplified colors output
|Reported by:||lucadelu||Owned by:|
|Keywords:||colors, r.colors.out, v.colors.out||Cc:|
At time the *.colors.out commands output a color table as-is. This is not necessarily useful when it comes to export for WMS etc which ideally uses a minimalistic color table. Example: a Celsius temperature map comes with a long FP color table but for Web representation it is sufficient to provide a simplified table.
Hence, the *.colors.out could offer a reclassified table based on the original FP color table.
To optionally reduce the number of output colors values for a map, I introduced a new parameter (classes) in *.colors.out.
It works as follows:
- first obtain the number of all color values and divide it with the number of classes set by the user to obtain the bin size,
- In the existing Rast_print_colors() there is a "for" loop in which we can check the values if the color table row is the first, last or a multiple of our bin size and restrict printing to only these values.
At this point, *.colors.out will no longer only print the original FP color table, but optionally also a reduced classified color table for external use.
Please try the attached patch (one parameter added to Rast_print_colors() and update of respective calls elsewhere in GRASS) and let me know if acceptable.