Bug report #14301

simplification makes geometry-based expression values (such as $area) vary for symbology and labels

Added by Mathieu Pellerin - nIRV about 4 years ago. Updated almost 4 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Simplification
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:22292

Description

When simplification is activated for a given vector layer, geometry-based expression values - such as $area - will vary within a symbology or label context when the zoom level in changed. I haven't looked at the code, but what I'm assuming happens here is that the expression is run against the simplified geometry, leading to varying values as the geometry is morphed.

That's a significant shortcoming that would be worth addressing. I discovered this when a number of polygons were going missing in a project using a density-based expression to make a graduated symbology.

I'm attaching a small test project to this issue that shows a polygon disappearing when zooming out (due to simplified polygon having an erroneous $area value).

Steps to reproduce
  1. Open the attached project
  2. Notice the rule-based expression being used: ($area / 10000) > 1309 AND ($area / 10000) < 1310
  3. Zoom out onto the canvas a couple of times, you'll see the polygon go missing

If you change the symbology to a single symbol, you can zoom in and out and notice the label (which shows the result of the following expression: $area / 10000) value varies as the simplified polygon returns different $area values.

expression_area_simplification.zip (311 KB) Mathieu Pellerin - nIRV, 2016-02-15 07:06 PM

Associated revisions

Revision d4a482b9
Added by Nyall Dawson almost 4 years ago

Merge pull request #2900 from ahuarte47/Issue_QPainterSimplification

[Bugfix] QPainter simplification (fixes #14301)

History

#1 Updated by Alvaro Huarte about 4 years ago

Hi, I would like to propose this pull [https://github.com/qgis/QGIS/pull/2900] to fix the issue.

Best regards
Alvaro

#2 Updated by Nyall Dawson almost 4 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF