Opened 9 years ago

Last modified 7 years ago

#2029 new defect

raster legend on discrete maps not graduated

Reported by: timmie Owned by: grass-dev@…
Priority: normal Milestone: 6.4.6
Component: Raster Version: unspecified
Keywords: d.legend, r.reclass Cc:
CPU: Unspecified Platform: Unspecified

Description

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

Change History (5)

comment:1 by hamish, 9 years ago

Keywords: d.legend added

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

in reply to:  1 comment:2 by timmie, 9 years ago

Replying to 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 ... | | | +----------------------------------------------------------------------------+

comment:3 by hamish, 9 years ago

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

comment:4 by hamish, 9 years ago

Keywords: r.reclass added

comment:5 by neteler, 7 years ago

Milestone: 6.4.46.4.6
Note: See TracTickets for help on using tickets.