[GRASS-dev] [GRASS GIS] #974: [Patch] add option to d.vect to make symbol size proportionate to square root of size_column

#974: [Patch] add option to d.vect to make symbol size proportionate to square
root of size_column
-------------------------+--------------------------------------------------
Reporter: mlennert | Owner: grass-dev@lists.osgeo.org
     Type: enhancement | Status: new
Priority: normal | Milestone: 7.0.0
Component: Display | Version: unspecified
Keywords: | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------
The attached patch adds a flag to d.vect to use the square root of the
size_column values. This allows to make the surface of circles instead of
their heights proportionate to the size value.

I did not want to commit immediately as I saw that Hamish was working on
d.vect. BTW thanks for allowing to scale the size_column value.

Moritz

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

#974: [Patch] add option to d.vect to make symbol size proportionate to square
root of size_column
--------------------------+-------------------------------------------------
  Reporter: mlennert | Owner: grass-dev@lists.osgeo.org
      Type: enhancement | Status: new
  Priority: normal | Milestone: 7.0.0
Component: Display | Version: unspecified
Resolution: | Keywords:
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Comment (by hamish):

(trac is logging me out every 5 minutes and it's driving me nuts!)

Hi,

I'm fine with the patch, a couple of comments though,

  - patches are '''''much''''' easier to review if they are kept to just
the change you are talking about. ie gratuitous whitespace changes should
be put in another patch if at all. signal:noise ratios & wasted time ...

  - please don't run the indent script unless you've added a bunch of new
code which needs it. see the comments in the SUBMITTING file.

  - if using sqrt() please #include <math.h>

  - sqrt_flag->description: please split into two parts: short description
on flag->label= line and "i.e." on flag->description= line (it becomes the
tooltip).

non-specific comments-
  - I worry that the d.vect interface is becoming like a 747 cockpit for
new users. So many controls it becomes overwhelming. the solution I guess
is good use of tabs and specific task wrapper scripts (eg addons
d.stations and d.varea).

  - now that d.vect has support for sizecol, rgbcol, widthcol, zcolor, etc,
what is left for d.thematic.linepoint to do?

cheers,
Hamish

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

#974: [Patch] add option to d.vect to make symbol size proportionate to square
root of size_column
--------------------------+-------------------------------------------------
  Reporter: mlennert | Owner: grass-dev@lists.osgeo.org
      Type: enhancement | Status: closed
  Priority: normal | Milestone: 7.0.0
Component: Display | Version: unspecified
Resolution: fixed | Keywords:
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Changes (by mlennert):

  * status: new => closed
  * resolution: => fixed

Comment:

Replying to [comment:1 hamish]:
> I'm fine with the patch, a couple of comments though,
>
> - patches are '''''much''''' easier to review if they are kept to just
the change you are talking about. ie gratuitous whitespace changes should
be put in another patch if at all. signal:noise ratios & wasted time ...
>
> - please don't run the indent script unless you've added a bunch of new
code which needs it. see the comments in the SUBMITTING file.

Sorry, thought indent should always be run. But understand the point and
won't do it again :wink:

> - if using sqrt() please #include <math.h>
>
> - sqrt_flag->description: please split into two parts: short
description on flag->label= line and "i.e." on flag->description= line (it
becomes the tooltip).

I've just committed a corrected version of the patch to trunk.

Closing this and responding to the other issues on the mailing list.

Moritz

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

On 02/03/10 10:21, GRASS GIS wrote:
-------------------------------------------------

Comment (by hamish):
  non-specific comments-
   - I worry that the d.vect interface is becoming like a 747 cockpit for
  new users. So many controls it becomes overwhelming. the solution I guess
  is good use of tabs and specific task wrapper scripts (eg addons
  d.stations and d.varea).

I agree, but see below.

   - now that d.vect has support for sizecol, rgbcol, widthcol, zcolor, etc,
  what is left for d.thematic.linepoint to do?

I've been thinking about this as well these days. What is still missing right now is an easy way to display a combination of color-classified and proportionately sized symbols. It is possible to declare an arbitrary numeric column as z-height and use that with zcolor, but I don't think this is very straightforward and even though ISTR you don't see the need for that, cartographic theory (at least for thematic maps) still calls for reduced numbers of classes.

However, I think that we now have the tools to actually script this combining v.class and d.vect, using the first to define the classes which we then use to fill the rgbcol or possibly size_column for those who want. Two necessary/useful additions would probably be:

- g.colorclasses providing color schemes (possibly integrating color combinations from [1]. I'll have to check licensing issues, but think uDig has integrated it already, so it should be possible.)

- d.thematic.legend to display legend info (both color classes and sizes)

However, if we go this way, I would need to add a flag to d.vect which allows sorting symbols with the largest in the back. This is absolutely necessary for readability. However, this implies a fundamental change in the d.vect code, as currently d.vect gets each feature from a map one at a time and then paints it. In order to allow sorting the symbols, we would have to sort the data first, loop through the cats in the defined order, find each feature according to its cat and then paint it. I've implemented this a long time ago in an alternative d.vect.chart [2]. An added advantage of this approach would be that it would open the door to a more database-oriented approach to displaying vectors in that it makes it possible to use an arbitrary SQL-query (including combination of several tables, etc) in d.vect to select those features you want to display. See [3] for an example.

So, either I go for a more complete revision of d.vect, or I use d.vect as a basis to create d.thematic.symbol (I like this name more than d.thematic.linepoint).

In any case, a gui script to integrate these different elements and provide things like a color choser for classes would be nice.

What do y'all think ?

Moritz

[1] http://www.personal.psu.edu/cab38/ColorBrewer/ColorBrewer_intro.html
[2] http://grass.itc.it/pipermail/grass5/2006-October/026503.html
[3] http://grass.itc.it/pipermail/grass5/2006-October/026504.html

Moritz wrote:

What is still missing right now is an easy way to display a
combination of color-classified and proportionately sized
symbols.

by the way, WRT floating point raster maps there is a control in ps.map's
colortable instruction to show range bands instead of a smooth legend:

"""
       Adding the
       discrete Y instruction will command the program to
       treat the map as a categorical map. In this way the
       legend can be created with discrete range bands instead
       of a continuous gradient. You must use the r.category
       or r.support module to set up the range labels first.
"""

Hamish