[GRASS5] [bug #4037] (grass) d.vect.thematic: fails to generate a legend for >20 custom_breaks

this bug's URL: http://intevation.de/rt/webrt?serial_num=4037
-------------------------------------------------------------------------

Subject: d.vect.thematic: fails to generate a legend for >20 custom_breaks

Platform: GNU/Linux/x86
grass obtained from: Trento Italy site
grass binary for platform: Compiled from Sources
GRASS Version: cvs 2005.01.10

d.vect.thematic map=rogow_parcels_01 type=area column=CODE themetype=graduated_colors themecalc=custom_breaks 'breakpoints=1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21' layer=1 icon=basic/circle size=5 maxsize=20 nint=4 colorscheme=green-red pointcolor=255:128:1 linecolor=0:0:0 startcolor=255:128:255 endcolor=255:255:255 monitor=x1 -l

**************************************************

Thematic map legend for column CODE of map rogow_parcels_01

Value range: 1.000000 - 666.000000

Color(R:G:B) Value
============ ==========
0:255:0 1 - 2
13:242:0 2 - 3
26:229:0 3 - 4
39:216:0 4 - 5
52:203:0 5 - 6
65:190:0 6 - 7
78:177:0 7 - 8
91:164:0 8 - 9
104:151:0 9 - 10
117:138:0 10 - 11
130:125:0 11 - 12
143:112:0 12 - 13
156:99:0 13 - 14
169:86:0 14 - 15
182:73:0 15 - 16
195:60:0 16 - 17
208:47:0 17 - 18
221:34:0 18 - 19
234:21:0 19 - 20
255:0:0 20 - 21

GRASS_INFO_WARNING(3623,1): Problem parsing command [8 -1]

GRASS_INFO_WARNING(3623,2): Problem parsing command [5 -1]

20 custom_breaks are supported in general. Only that -l switch cannot be used along.

Maciek

-------------------------------------------- Managed by Request Tracker

[Maciek found a misspecification in d.vect.thematic: the
legend-drawing code is designed for a small number of categories;
going from 20 up, it feeds negative coordinates into d.graph, which
chokes and spits]

What is the right solution?

a) allow >20 items in the legend, shrinking it to fit all of them
b) make the legend with only 20 items (say the 10 lower, a mark and
the 10 upper) with a warning
c) signal >20 items as an error or warning and do not output the legend
d) other suggestion

I like b). c) is of course the easiest. a) is a little involved (since
this is sh) and it would allow for legends of arbitrary number of
items, which makes unreadably absurd legends possible.

Daniel.

-- Daniel Calvelo Aros

Thanks for fixing this Daniel. The legend is very restricted due to the
limitations of d.graph. (b) sounds like the best to me also.

Michael
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution and Social Change
Arizona State University
Tempe, AZ 85287-2402

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

From: Daniel Calvelo <dca.gis@gmail.com>
Date: Thu, 26 Jan 2006 00:55:19 -0500
To: Request Tracker <grass-bugs@intevation.de>
Cc: <grass5@grass.itc.it>
Subject: Re: [GRASS5] [bug #4037] (grass) d.vect.thematic: fails to generate a
legend for >20 custom_breaks

[Maciek found a misspecification in d.vect.thematic: the
legend-drawing code is designed for a small number of categories;
going from 20 up, it feeds negative coordinates into d.graph, which
chokes and spits]

What is the right solution?

a) allow >20 items in the legend, shrinking it to fit all of them
b) make the legend with only 20 items (say the 10 lower, a mark and
the 10 upper) with a warning
c) signal >20 items as an error or warning and do not output the legend
d) other suggestion

I like b). c) is of course the easiest. a) is a little involved (since
this is sh) and it would allow for legends of arbitrary number of
items, which makes unreadably absurd legends possible.

Daniel.

-- Daniel Calvelo Aros

Michael Barton wrote:

Thanks for fixing this Daniel. The legend is very restricted due to the
limitations of d.graph. (b) sounds like the best to me also.

Should the psmap legend file correspond to the displayed legend ? This would have to be changed also, then.

Moritz

Daniel and others,

Thinking about this on the commute to work this morning, I came up with an
idea for a longer-term way to deal with vector thematic mapping and legends.
For vectors, I can't think of a situation where a legend is NOT used for
some kind of thematic mapping, even if there is a legend item for each
vector object. That is, it is somewhat different from raster legends for
floating point maps. So here is my idea that builds on the unique
multi-layer vector architecture for GRASS.

Each vector file would get a special layer (call it the "T" layer for this
exercise) for thematic mapping. It also would get a special attribute table
(call it "vtheme" for the sake of argument). The T layer and vtheme table
are generated for every vector file on creation. Default cats for the T
layer are simply 1 for each vector item and vtheme is empty except for cats.

The vtheme table would minimally contain the following fields:

psize (point size)
lwidth (line width)
lcolor (line color)
fcolor (fill color)
tlabel (thematic vector label)

It could also contain some topology placeholder fields like length (line
length) or area.

d.vect.thematic (hopefully a C version of it) would repopulate the T layer
so that each vector object gets a cat indicating its membership in a
thematic class. The vtheme table would be populated by parameters generated
by d.vect.thematic (and optionally by other modules like v.to.db for
topology)

Any legend-generating program (an enhanced version of d.legend, a new
d.vect.legend, or even a GUI) could easily obtain the information needed to
create a nice legend using v.db.select.

What do you think?

Michael
______________________________
Michael Barton, Professor of Anthropology
School of Human Evolution and Social Change
Arizona State University
Tempe, AZ 85287-2402
USA

voice: 480-965-6262; fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

From: Daniel Calvelo <dca.gis@gmail.com>
Date: Thu, 26 Jan 2006 00:55:19 -0500
To: Request Tracker <grass-bugs@intevation.de>
Cc: <grass5@grass.itc.it>
Subject: Re: [GRASS5] [bug #4037] (grass) d.vect.thematic: fails to generate a
legend for >20 custom_breaks

[Maciek found a misspecification in d.vect.thematic: the
legend-drawing code is designed for a small number of categories;
going from 20 up, it feeds negative coordinates into d.graph, which
chokes and spits]

What is the right solution?

a) allow >20 items in the legend, shrinking it to fit all of them
b) make the legend with only 20 items (say the 10 lower, a mark and
the 10 upper) with a warning
c) signal >20 items as an error or warning and do not output the legend
d) other suggestion

I like b). c) is of course the easiest. a) is a little involved (since
this is sh) and it would allow for legends of arbitrary number of
items, which makes unreadably absurd legends possible.

Daniel.

-- Daniel Calvelo Aros

Thanks for fixing this Daniel. The legend is very restricted due to
the limitations of d.graph. (b) sounds like the best to me also.

Suggestions for improvements welcome..

Hamish

Thinking about this on the commute to work this morning, I came up
with an idea for a longer-term way to deal with vector thematic
mapping and legends. For vectors, I can't think of a situation where a
legend is NOT used for some kind of thematic mapping, even if there is
a legend item for each vector object. That is, it is somewhat
different from raster legends for floating point maps. So here is my
idea that builds on the unique multi-layer vector architecture for
GRASS.

The data I work with is often a swarm of vector points. e.g. bathymetric
soundings or a trail of measurements (e.g. temperature) along a line of
gps track points. In these cases a pseudo-continuous legend (like
d.legend for floating point) is preferable. Currently I calculate RGB
values in Matlab during post-processing and place in a GRASSRGB column,
but this is unpractible for e.g. LIDAR data where there can be no table.
Automatic would be better.

d.vect.thematic doesn't have to support this, but a use case to
consider..

As was earlier suggested on the list, reusing the r.colors colr/ files
for vectors would be neat. Only thing to check is that the functions
that query the color don't need a raster to be open. i.e. the
vector/display libs can't depend on the raster lib.

Hamish

> Thanks for fixing this Daniel. The legend is very restricted due to
> the limitations of d.graph. (b) sounds like the best to me also.

Suggestions for improvements welcome..

I'm not sure if I mentioned this before, but I have pretty much finished
adding library funcitons for drawing symbols. Minor issues remain:

gis.h needs a G_RGB_color structure. I have this but include fp_red,
...?

d.graph: need to somehow get the current color from the display driver
before changing fg,bg color to draw icon, so it'll return to that color
after.

These won't go in to CVS until I'm back from sea late next month.

Hamish

Hamish,

Thanks for all this work. Do you mean get the current screen color? If so, I
don't think that is an issue for a legend, unless it would affect all
subsequent screens. Also, is this set us such that d.graph could draw to the
png driver?

Michael
______________________________
Michael Barton, Professor of Anthropology
School of Human Evolution and Social Change
Arizona State University
Tempe, AZ 85287-2402
USA

voice: 480-965-6262; fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

From: Hamish <hamish_nospam@yahoo.com>
Date: Fri, 27 Jan 2006 13:12:46 +1300
To: <michael.barton@asu.edu>
Cc: <grass5@grass.itc.it>
Subject: Re: [GRASS5] [bug #4037] (grass) d.vect.thematic: fails to generate a
legend for >20 custom_breaks

Thanks for fixing this Daniel. The legend is very restricted due to
the limitations of d.graph. (b) sounds like the best to me also.

Suggestions for improvements welcome..

I'm not sure if I mentioned this before, but I have pretty much finished
adding library funcitons for drawing symbols. Minor issues remain:

gis.h needs a G_RGB_color structure. I have this but include fp_red,
...?

d.graph: need to somehow get the current color from the display driver
before changing fg,bg color to draw icon, so it'll return to that color
after.

These won't go in to CVS until I'm back from sea late next month.

Hamish