[GRASS-dev] [GRASS GIS] #2399: *.colors.out: simplified colors output

GRASS GIS trac at osgeo.org
Fri Aug 22 05:30:50 PDT 2014


#2399: *.colors.out: simplified colors output
------------------------------------------------+---------------------------
 Reporter:  lucadelu                            |       Owner:  grass-dev@…              
     Type:  enhancement                         |      Status:  new                      
 Priority:  normal                              |   Milestone:  7.1.0                    
Component:  Raster                              |     Version:  svn-trunk                
 Keywords:  colors, r.colors.out, v.colors.out  |    Platform:  All                      
      Cpu:  Unspecified                         |  
------------------------------------------------+---------------------------
 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.

-- 
Ticket URL: <http://trac.osgeo.org/grass/ticket/2399>
GRASS GIS <http://grass.osgeo.org>



More information about the grass-dev mailing list