qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.46k stars 2.99k forks source link

Implement gradient ramp based legends for Vector Layers #54772

Closed jo-chemla closed 5 months ago

jo-chemla commented 1 year ago

Feature description

It would be great to implement Gradient ramp based legends symbols for Vector layers - probably those with the Graduated Symbology for which a color ramp gradient is used. Would make it possible to implement Gradient Legends in the Print Layout without relying on hacky solutions like in this GIS StackExchange post

Additional context

This PR https://github.com/qgis/QGIS/pull/40598 (pushed to 3.18) implemented gradient ramp based legends for raster layers (pseudocolor + single band gray renderer), and for point clouds using a ramp based renderer (see example blog post here). It would be great to port these gradient legends items to vector layers with graduated symbology as well.

jo-chemla commented 5 months ago

Thanks @nyalldawson for implementing gradient symbol for vector layers! It seems that the commit referenced adds support for heatmap only, is that correct? It would also make sense to implement that gradient ramp legend symbol for simple Graduated symbology, will this work with that commit? Thanks!

nyalldawson commented 5 months ago

@jo-chemla yes, I only had funding to implement this for the heatmap renderer, but the API changes would permit this to also be used for graduated renderer / data defined colour layers

jo-chemla commented 5 months ago

Alright understood, thanks for the precision and the feature! Should I open a new issue thread dedicated to the Graduated type or better reopen this one to keep track of progress?

nyalldawson commented 5 months ago

@jo-chemla

Should I open a new issue thread dedicated to the Graduated type

Yes please! That one needs some discussion, because the graduated renderer doesn't use a continuous set of colors from the ramp but rather uses the colors from the classes. So it's debatable whether it's a valid change or not. But for color assistants (data defined color) taking colors from ramps, then yes, we should show a ramp legend for these layers.