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.5k stars 2.99k forks source link

Geometry generator symbology in legend item blows up when hardcoded #49728

Closed geistiii closed 1 year ago

geistiii commented 2 years ago

What is the bug or the crash?

Layout manager - Legend item & geometry generated symbols

Symbology including hardcoded geometry generator buffers (e.g. buffer($geometry,80,80)), here for a point layer, is displayed in the legend item exactly as in the map item. This is undesireable since the symbol covers half the legend item.

If the geometry genereator buffer is based on an attribute (e.g. buffer($geometry, (CASE WHEN TYPE = 'A' THEN 50 WHEN TYPE = 'B' THEN 75 ELSE 100 END),80)) the symbol is displayed as it was in 3.16, as a point with a small rectangle surrounding it. While not ideal, this is preferrable over the behaviour described above.

The following exported map shows the issue.

20220810_QGIS-3-22_Bug-report_geometry-generator-in-legend.pdf

Steps to reproduce the issue

  1. Create a (temporary) geometry layer with a text-attribute called TYPE using a projected CRS
  2. Digitize at least one feature, the attribute can be filled in as 'A' or 'B', any other charater/string or be left empty
  3. In the layer properties go to the symbology tab
  4. Add a layer to the symbology
  5. Change the style of the new layer to geometry generator
  6. Enter buffer($geometry,80,80) as the geometry to be displayed
  7. Save the symbology, close the layer properties
  8. Duplicate the layer
  9. Go to the layer properties of the duplicated layer
  10. In the symbology tab, change the expression for the geometry generator to buffer($geometry, (CASE WHEN TYPE = 'A' THEN 50 WHEN TYPE = 'B' THEN 75 ELSE 100 END),80)
  11. Save the symbology and close the duplicated layer's properties
  12. Add a layout to the project
  13. Add a map item to the layout
  14. In the map item zoom to the created feature layer so the features cover a significant portion of the canvas
  15. Add a legend item to the layout
  16. Add the original and the duplicated layer to the legend item. The original layer should cover a large portion of the legend item

Versions

QGIS-Version 3.22.9-Białowieża QGIS-Codeversion a8e9e6fa Qt-Version 5.15.3 Python-Version 3.9.5 GDAL-Version 3.5.1 PROJ-Version 9.0.1 EPSG-Registraturdatenbankversion v10.064 (2022-05-19) GEOS-Version 3.10.3-CAPI-1.16.1 SQLite-Version 3.38.1 PDAL-Version 2.3.0 PostgreSQL-Client-Version 14.3 SpatiaLite-Version 5.0.1 QWT-Version 6.1.6 QScintilla2-Version 2.13.1 BS-Version Windows 10 Version 2009

Aktive Python-Erweiterungen GeoCoding 2.18 LAStools 1.4 latlontools 3.6.4 Mergin 2022.5 point_selection 0.5 profiletool 4.2.2 QuickOSM 2.0.1 grassprovider 2.12.99 processing 2.12.99 sagaprovider 2.12.99

Supported QGIS version

New profile

Additional context

No response

gioman commented 2 years ago

image