Opened 10 years ago

Last modified 6 years ago

#2399 new enhancement

*.colors.out: simplified colors output

Reported by: lucadelu Owned by: grass-dev@…
Priority: normal Milestone: 7.6.2
Component: Raster Version: svn-trunk
Keywords: colors, r.colors.out, v.colors.out Cc:
CPU: Unspecified Platform: All

Description

Hi devs,

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.

Proposal:

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.

Attachments (1)

colors.out.diff (8.6 KB ) - added by lucadelu 10 years ago.
patch for new classes option

Download all attachments as: .zip

Change History (12)

comment:1 by annakrat, 10 years ago

Is the patch complete? I miss the Rast_print_colors function code.

by lucadelu, 10 years ago

Attachment: colors.out.diff added

patch for new classes option

comment:2 by lucadelu, 10 years ago

Now it should be complete.

Sorry Luca

comment:3 by neteler, 9 years ago

Milestone: 7.1.07.2.0

Milestone renamed

comment:4 by neteler, 8 years ago

Milestone: 7.2.07.2.1

Ticket retargeted after milestone closed

comment:5 by martinl, 8 years ago

Milestone: 7.2.17.2.2

comment:6 by martinl, 7 years ago

Milestone: 7.2.27.4.0

All enhancement tickets should be assigned to 7.4 milestone.

comment:7 by neteler, 7 years ago

Milestone: 7.4.07.4.1

Ticket retargeted after milestone closed

comment:8 by neteler, 7 years ago

Milestone: 7.4.17.4.2

comment:9 by martinl, 6 years ago

Milestone: 7.4.27.6.0

All enhancement tickets should be assigned to 7.6 milestone.

comment:10 by martinl, 6 years ago

Milestone: 7.6.07.6.1

Ticket retargeted after milestone closed

comment:11 by martinl, 6 years ago

Milestone: 7.6.17.6.2

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.