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

Michael Barton michael.barton at asu.edu
Thu Jan 26 10:54:52 EST 2006

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

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 Barton, Professor of Anthropology
School of Human Evolution and Social Change
Arizona State University
Tempe, AZ  85287-2402

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

> From: Daniel Calvelo <dca.gis at gmail.com>
> Date: Thu, 26 Jan 2006 00:55:19 -0500
> To: Request Tracker <grass-bugs at intevation.de>
> Cc: <grass5 at 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

More information about the grass-dev mailing list