[QGIS-Developer] Symbology: multiple simple marker symbols are not correctly aligned on top of each other

Nyall Dawson nyall.dawson at gmail.com
Sun Jul 5 15:51:12 PDT 2020


On Sat, 4 Jul 2020 at 00:27, Andreas Neumann <a.neumann at carto.net> wrote:
>
> Hi,
>
> Here is something that bothered me already for many years in QGIS and I think it might be a long standing issue in QGIS symbology:
>
> When you place two simple markers on top of each other (without any offset), f.e. two circle symbols on top of each other, they are not correctly aligned/centered on top of each other: The alignment is a tiny bit off, but it looks ugly and it annoys me a lot.
>
> The misalignment is not only in the preview dialogue but also visible in the map rendering.
>
> In the symbol preview dialog there is a second annoying thing: strokes in the preview are often clipped away, as you can see in the dialog above
>
> Can we do something about it these two annoying issues?

QGIS isn't actually doing anything wrong here -- it's to do with how
Qt is antialiasing the symbol rendering. For some sizes it's able to
snap the rendered shape to nice pixel boundaries, but for other
in-between sizes it isn't, and you get these small shifts. If you use
a hidpi display, or export the map to a vector format like PDF or SVG,
you won't see it anymore. Same if you use the magnifier tool to zoom
into the map.

I'm not sure there's anything we can do here. That said, one
experiment I played with about a year ago was to upgrade the symbol
preview picture to use a QgsMapCanvas widget. The symbol is then
rendered using a geometry of suitable shape, and you can nicely
interact with the preview including being able to zoom in and out of
the preview (which makes it easy to verify that the multiple layers
are indeed correctly centered). It also means that we can synchronize
the scale and center of the symbol preview canvas widget with the main
map canvas' scale and center, so that symbol sizes set to map units
show exactly as they'll appear on the map.

If anyone's interested in playing, heres' the WIP commit:
https://github.com/nyalldawson/QGIS/commit/db8364d989e8092c6db4ebc88deeb62cad4743d1
. There's a good couple of hours left to go to get that over the
finish line though.

Nyall


More information about the QGIS-Developer mailing list