Opened 5 years ago

Last modified 5 months 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 5 years ago.
patch for new classes option

Download all attachments as: .zip

Change History (12)

comment:1 Changed 5 years ago by annakrat

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

Changed 5 years ago by lucadelu

Attachment: colors.out.diff added

patch for new classes option

comment:2 Changed 5 years ago by lucadelu

Now it should be complete.

Sorry Luca

comment:3 Changed 3 years ago by neteler

Milestone: 7.1.07.2.0

Milestone renamed

comment:4 Changed 3 years ago by neteler

Milestone: 7.2.07.2.1

Ticket retargeted after milestone closed

comment:5 Changed 2 years ago by martinl

Milestone: 7.2.17.2.2

comment:6 Changed 2 years ago by martinl

Milestone: 7.2.27.4.0

All enhancement tickets should be assigned to 7.4 milestone.

comment:7 Changed 19 months ago by neteler

Milestone: 7.4.07.4.1

Ticket retargeted after milestone closed

comment:8 Changed 14 months ago by neteler

Milestone: 7.4.17.4.2

comment:9 Changed 11 months ago by martinl

Milestone: 7.4.27.6.0

All enhancement tickets should be assigned to 7.6 milestone.

comment:10 Changed 7 months ago by martinl

Milestone: 7.6.07.6.1

Ticket retargeted after milestone closed

comment:11 Changed 5 months ago by martinl

Milestone: 7.6.17.6.2

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.