OSGeo / grass

GRASS GIS - free and open-source geospatial processing engine
https://grass.osgeo.org
Other
824 stars 301 forks source link

[Feat] Ideas for better thematic mapping with vectors #3128

Open cmbarton opened 1 year ago

cmbarton commented 1 year ago

Is your feature request related to a problem? Please describe. Thematic mapping with vectors has always been very hard to do in GRASS

Describe the solution you'd like I wrote this to the dev list, but it is better here as an issue to be discussed and modified.

An Initial Roadmap for Thematic Mapping in GRASS

  1. Add a checkbox to d.vect to explicitly use the color table or not. Make it default to on. There is the option to use a single color or an rgb column, but nothing to explicitly use the color table.
  2. Most of the tools to create thematic maps are already in d.vect or in vector color management (v.color or interactive color rules management). The only things missing are the 3 arguments on the classification tab for d.vector.thematic. Those could be added to v.color and/or interactive color management tool for colors. Probably the easiest place to do this is in the interactive color rule tool.
  3. Add an option to generate a correct legend file to the interactive color rule tool, like it has for creating a color rules file (see #3127). d.vect.thematic already has this option (and hence the needed code), although it does not create a legend file correctly at present (#3100); and d.vect.chart does create a correct legend file.
  4. . Currently, colors (and point/line sizes) can only be varied using an integer data column. This means that we cannot thematically map a floating point value which is a significant limit with real world data. This should be easily fixable. It also makes it more complicated to thematically map a categorical variable. If numbers are needed by an internal library for thematic mapping, a categorical variable could be mapped if there were a way to generate a needed integer equivalent on the fly. But if letting color vary by string value directly is too complicated, there needs to be an option to pick a text column for labeling legends where ever these are generated.
  5. If we simply improve the creation and use of vector color tables like we do for rasters, it could obviate the need for an rgb column. But if there are reasons to keep that, it will be helpful to make it possible for color table info to be saved to an rgb column. currently if you have a color table and try to select rgb to save it, all the color info disappears.
  6. Finally, change d.vect.thematic so that it is a tool for setting the sizes of points and widths of lines. This is now included as part of d.vect, but with no way of getting a legend for these display sizes. We could also combine d.vect.thematic and the interactive color rules tool because setting colors is also thematic mapping.
cmbarton commented 7 months ago

After testing the current version of d.vect.thematic, I can say that it works very well--especially with the automatic legend creation.

The main issues remaining are related to thematic mapping tools being spread across several disconnected modules. The goal is to allow vector objects to be displayed (color, size, rotation) according to some variable and create a legend to explain this thematic map.

  1. the disconnect between the color table management tools (both auto and manual) and d.vect.thematic, which can't use a color table;
  2. the disconnect between the symbol size or rotation, and line thickness thematic mapping in d.vect and their lack in d.vect.thematic; and
  3. the need for automatic legend generation in modules beyond d.vect.thematic.

So some revised suggestions:

  1. Leave color table management as it is now, but regularize the use of vector color tables as suggested above. Make it easier for an RGB column to be populated from a color table or a color table to be created from an RGB column--or dispense with RGB columns perhaps and allow for multiple, named color tables to be saved and used instead.
  2. Enable d.vect.thematic and d.vect.chart to use a color table defined for a vector as an alternative to manually listing colors.
  3. Either add point/line size/rotation options to d.vect.thematic or enable d.vect to generate a legend in the same way that d.vect.thematic does.
  4. Enable d.vect.chart to generate a legend in the same way that d.vect.thematic does
  5. A way to create a legend for gradient colors or size variation, as for rasters now, would be nice but maybe that is more than can be done currently.