Bug report #18384

Combination of segments_to_lines($geometry) and @geometry_part_num gives wrong segment numbers

Added by Michel Stuyts about 1 year ago. Updated 4 months ago.

Status:Closed
Priority:High
Assignee:Nyall Dawson
Category:Symbology
Affected QGIS version:3.5(master) Regression?:Yes
Operating System:Windows 10 & Ubuntu Linux 17.10 Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No

Description

When creating a style (segments.qml) for a polygon layer I noticed a difference between QGIS 2.99 (Windows standalone installer) and QGIS 3.0 (OSGeo4W) when I use segments_to_lines & @geometry_part_num.

  • I created a polygon layer and added some polygons.
  • Then I started editing the layer style:
    • I added a Geometry generator as symbol layer to create a Linestring type that contains segments_to_lines($geometry)
    • Then I changed the line type of the result to a "Marker line"
    • Then I changed the Symbol layer type of this "Marker line" to "Font marker"
    • Then I changed the "Data defined override" of the content of this font marker to @geometry_part_num
    • Then I changed the font size of the font marker

The results are different in QGIS 2.99 and 3.0 (see images below). Is this a bug in 3.0 or is it an intentional change? The result in QGIS 2.18 is the same as in 2.99. The result in QGIS 3.1 is the same as in 3.0. I also tested it in QGIS 3.0 on Ubuntu 17.10 it gives the same result as 3.0 in Windows.

test_qgis299.jpg (20.3 KB) Michel Stuyts, 2018-03-08 12:10 PM

test_qgis300.jpg (19.8 KB) Michel Stuyts, 2018-03-08 12:10 PM

segments.qml (11 KB) Michel Stuyts, 2018-03-08 12:12 PM

Associated revisions

Revision 9cf2ff31
Added by Nyall Dawson 4 months ago

Fix evaluation of data defined properties for subsymbols of subsymbols

Fixes #18384

Revision 7e25cea7
Added by Nyall Dawson 4 months ago

Fix evaluation of data defined properties for subsymbols of subsymbols

Fixes #18384

(cherry picked from commit 9cf2ff31d86e6b7671aaca137a60a7b7a975ef62)

History

#1 Updated by Giovanni Manghi about 1 year ago

  • Priority changed from Normal to High
  • Regression? changed from No to Yes

Seems a bug to me, but I'm not 100% sure. Hopefully a developer will clarify here.

#2 Updated by Anita Graser about 1 year ago

When this happens, @geometry_part_count is always 1. No matter how complex the original feature is.

#3 Updated by Anita Graser about 1 year ago

I've hunted down the issue: it seems like @geometry_part_num values change irrespective of the geometry generator expression.

This short screen cast should explain it better than words: https://www.dropbox.com/s/cvyqeecpq0uis1j/QGIS%20Geometry%20Generator%20geometry_part_num.mp4?dl=0

Basically, if you just use @geometry_part_num in the font marker text expression, it will always display 1.

If you additionally use @geometry_part_num in an expression for a simple line that is part of the same geometry generator tree, the values change to 1...n

#5 Updated by Nyall Dawson 4 months ago

  • Status changed from Open to In Progress
  • Assignee set to Nyall Dawson
  • Affected QGIS version changed from 3.0.0 to 3.5(master)

#6 Updated by Nyall Dawson 4 months ago

  • % Done changed from 0 to 100
  • Status changed from In Progress to Closed

Also available in: Atom PDF