[GRASS-dev] [GRASS GIS] #2029: raster legend on discrete maps not graduated

#2029: raster legend on discrete maps not graduated
-------------------------+--------------------------------------------------
Reporter: timmie | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.4
Component: Raster | Version: unspecified
Keywords: | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------
I reclassified a continous integer value raster into discrete classes.

But when adding a raster legend to the map, it still shows a continued,
map with a colour gradient.

This is not true as the raster map values have true and hard class breaks.

How can I get aroudn this limitation of the map legend (this also
applies to the ps.map dialogue).

http://permalink.gmane.org/gmane.comp.gis.grass.user/47740

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2029&gt;
GRASS GIS <http://grass.osgeo.org>

#2029: raster legend on discrete maps not graduated
-------------------------+--------------------------------------------------
Reporter: timmie | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.4
Component: Raster | Version: unspecified
Keywords: d.legend | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------
Changes (by hamish):

  * keywords: => d.legend

Comment:

How many categories in the final image?

If there are more categories than there are vertical pixels to display
them in, d.legend automatically changes into smooth gradient mode; it
issues you a warning telling you that it did it in that case.

the various thin=, lines=, and use= options can be used to reduce the
number of categories to something that will fit on the screen. Also you
should check that the map being used is a CELL map, not a FCELL or DCELL.

beyond that, I'd need more information to go on about your raster.
(r.info, screenshots, exact CLI commands to reproduce, xmon or wxGUI, ...)

regards,
Hamish

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2029#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#2029: raster legend on discrete maps not graduated
-------------------------+--------------------------------------------------
Reporter: timmie | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.4
Component: Raster | Version: unspecified
Keywords: d.legend | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Comment(by timmie):

Replying to [comment:1 hamish]:
> How many categories in the final image?
5-15 categories.

> If there are more categories than there are vertical pixels to display
them in, d.legend automatically changes into smooth gradient mode; it
issues you a warning telling you that it did it in that case.
I did not see this.
Just a gradient legend with the category breaks as legend labels.

> the various thin=, lines=, and use= options can be used to reduce the
number of categories to something that will fit on the screen. Also you
should check that the map being used is a CELL map, not a FCELL or DCELL.
It's DCELL.

> beyond that, I'd need more information to go on about your raster.
(r.info, screenshots, exact CLI commands to reproduce, xmon or wxGUI, ...)

r.info map=landcover_zones@land
+----------------------------------------------------------------------------+
  | Layer: landcover_zon Date: Fri Apr 05 11:45:37 2013 |
  | Mapset: land Login of Creator: timmie
|
  | Location: 6.4_merc |
  | DataBase: /home/timmie/gis/grassdata
|
  | Title: Reclass of landcover |
  | Timestamp: none
|
|----------------------------------------------------------------------------|
  |
|
  | Type of Map: reclass Number of Categories: 0
|
  | Data Type: CELL
|
  | Rows: 12076
|
  | Columns: 16879
|
  | Total Cells: 203830804
|
  | Projection: Mercator
|
  | N: 6698600 S: 6491000 Res: 100
|
  | E: 2205800 W: 0517900 Res: 100
|
  | Range of data: min = 2099 max = 3000
|
  |
|
  | Data Source:
|
  | Reclassified map based on:
|
  | Map [landcover_base@land] in mapse |
  |
|
  | Data Description:
|
  |
|
  |
|
  | Comments:
|
  |
|
  | generated by r.reclass
|
  | r.reclass ... |
  |
|
+----------------------------------------------------------------------------+

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2029#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#2029: raster legend on discrete maps not graduated
-------------------------+--------------------------------------------------
Reporter: timmie | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.4
Component: Raster | Version: unspecified
Keywords: d.legend | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Comment(by hamish):

DCELL will always create a gradient legend, since it's a real number.
(unless you use the use= option)

A reclass of a floating point map should be a virtual CELL map, which is
what your r.info shows for the Data type.

note reclasses of floating point maps are not as well supported as
reclasses of cell maps. in fact the man page says it won't work at all,
but it "sort of" does. So I'm not very surprised things don't work 100%
with that.

fwiw, this works fine for me in devbr6:

{{{
# North Carolina dataset
g.region rast=slope

r.univar -e slope perc=0,10,20,30,40,50,60,70,80,90,100
0th percentile: 0
10th percentile: 0.94092
20th percentile: 1.57311
30th percentile: 2.12774
40th percentile: 2.66269
50th percentile: 3.21512
60th percentile: 3.82967
70th percentile: 4.56931
80th percentile: 5.58133
90th percentile: 7.39227
100th percentile: 38.6894

r.reclass in=slope out=slope.deciles rules=- << EOF
0 thru 0.94092 = 1 First decile
0.94092 thru 1.57311 = 2 Second decile
1.57311 thru 2.12774 = 3 Third decile
2.12774 thru 2.66269 = 4 Fourth decile
2.66269 thru 3.21512 = 5 Fifth decile
3.21512 thru 3.82967 = 6 Sixth decile
3.82967 thru 4.56931 = 7 Seventh decile
4.56931 thru 5.58133 = 8 Eighth decile
5.58133 thru 7.39227 = 9 Ninth decile
7.39227 thru 38.6894 = 10 Tenth decile
EOF

d.legend slope.deciles
}}}

Hamish

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2029#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#2029: raster legend on discrete maps not graduated
---------------------------------+------------------------------------------
Reporter: timmie | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.4
Component: Raster | Version: unspecified
Keywords: d.legend, r.reclass | Platform: Unspecified
      Cpu: Unspecified |
---------------------------------+------------------------------------------
Changes (by hamish):

  * keywords: d.legend => d.legend, r.reclass

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2029#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>