I have points that are labelled with a 2-digit numeric attribute, shown by default with a circle background (white fill, coloured outline of 1 map unit, buffer of 1 map unit beyond the label).

I have been asked to show deleted points (deleted since the last iteration of the map) with a diagonal slash through the number. I am attempting to do this using an SVG as the label background, but the results are pixelated. The width of the stroke element of the SVG also seems to change with zoom level. I am not offered an option for the units of stroke width on the SVG background, just "symbol units".

Are there settings I should check either in the original SVG file or in QGIS that might help with either or both of these?

pixelated view at medium zoom too-thick outline at high zoom

I am using this SVG: https://commons.wikimedia.org/wiki/File:Cross_within_circle_2.svg - I do not know why only one of the diagonal lines shows up (one or both would be fine). I don't know SVGs well but I am familiar with markup languages in principle and happy to attempt edits if provided with a little guidance.

Alternatively, is there another way that I can have the labels mimic the non-deleted points, just with the addition of a diagonal line?

I have suggested just using strikethrough text but this is deemed not clear enough by the recipient. However, at present it looks like a better alternative if I cannot fix the SVG issue.

(QGIS 3.4.7, Win10)


I'm not sure what's going wrong with your SVG symbol, but it's pretty simple to re-create a similar symbol using simple marker symbol levels. With simple markers, you can control the symbol size and stroke width using millimeters, points, pixels, meters at scale, map units, or inches.

Add three symbol levels:

  1. Simple marker - line, 45 degree rotation. Shown below with a 7mm circle, 0.5mm line width.
  2. Font marker. Shown below with 4mm size.

    Use this instead of a label if you want the line symbol to cross over (and partially obscure) the label. Select your "label" field from the data-defined control menu next to the character selection (see below).

enter image description here

Otherwise, omit this symbol level and keep the existing point labels. Use data-defined placement settings to control the label placement so they're always placed on top of the point symbol.
  1. Default simple marker (circle), transparent fill. Shown below with a 5mm circle in the example.

enter image description here

Note: even though all three of the symbol levels are anchored at the center point, the font marker appears slightly off-center. You can add a small offset to get it properly centered. A -0.5mm Y-offset (not shown) worked well for my example.

Adjust the colors and line widths to meet your needs. Try it with a square, diamond, pentagon or hexagon instead of a circle.

enter image description here 15mm diamond marker, 3mm stroke width

| improve this answer | |
  • Thank you. Can I apply this as a label background though? The only options for the Shape of the Background setting for labels are Rectangle, Circle Square, Ellipse and SVG. On the illustration in the original post, the circles on the pink line are the point markers, and the 04, 05. are labels (showing an attribute). – ermintrude75 Jun 18 '19 at 19:21
  • My mistake. I didn't notice those were label backgrounds, not symbols. No, I don't see any way to put this symbol in a label background other than using an SVG. As a workaround you could remove the label entirely, and substitute a font marker symbol layer (you can use a field value for the text). The variable stroke width seems like it might be a bug, so you could make a bug report. Or maybe it's a property of the SVG you're using. You could try a different SVG. – csk Jun 18 '19 at 19:35
  • Ah, OK - thank you anyway. I have tried an alternate SVG but the same problem persists with the stroke width varying by zoom level. I haven't made a QGIS bug report before but will look into it. – ermintrude75 Jun 18 '19 at 19:45

Further testing:

The pixelation is replicable - it is caused when there is a non-zero rotation applied to the SVG label background, or to the label as a whole via Placement. However, on export to PDF the background symbol is sharp.

The resizing behaviour is not replicable. I made a new label from scratch using the same settings and SVG, and it works as expected, with the symbol thickness remaining constant at all zoom levels. I have been through all label options several times and cannot see any setting that is different. The 'problem' label also behaves fine with any other SVG. A mystery!

Apologies for not testing more exhaustively in the first place. As it was my first time using an SVG background I assumed it was my error. Hopefully this helps anyone in future with the apparent pixelation issue, at least.

| improve this answer | |
  • Interesting. Still sounds like a bug, but not worth reporting since it isn't reproducible. Glad you got it working. – csk Jun 19 '19 at 17:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.