I want to keep the same line width but specify a much longer dash.

The symbology controls in QGIS 3 have changed significantly from 2.X, so the many answers re: line symbology control for QGIS 2.X are now obsolete.

When I attempt to edit the settings using the button-dropdown to the right of the Stroke style field, I invoke an Expression String Builder that might enable me to customize stroke styles to my heart's delight; but the syntax is not explained.

It looks like it expecting an SQL expression, because it looks like a similar dialog box for managing Attributes. But I cannot find any documentation on how it works. The "Expected Format: string [no|solid|dash|dot|dash dot|dash dot dot]" is cryptic.

  • The "Expected Format: string [no|solid|dash|dot|dash dot|dash dot dot]" refer to selecting between the predefined pattern (the same you can set in the drop list : Stroke Style). To create your own pattern see JGH answer below. – J.R Apr 9 at 11:50

The Stroke style allows you to select a predefined style.

To create a new dash pattern, tick the check box use custom dash pattern then click the change button.

From there, declare the dash length then the blank length. If you define several patterns, they are rendered one after another.

In the example below, the pattern is: black line for 15 mm, blank for 2 mm, black line for 1 mm, blank for 2 mm; and repeat the pattern.

enter image description here

PS: it is the same in QGIS 3 or 2.18


Ah! @JGH gave the vital clue. I thought that controlling line-stroke for polylines and the edges of polygons would have the same controls. I am editing symbology for polygon edges. By default on my QGIS 3 install (Linux) no options are presented: QGIS 3 Symbology Dialog for Polygon Layer

When I open the Symbol Layer Type drop-down field, I can select control of the Outline: QGIS 3 Symbology Dialog: Symbol Layer Type subfield And then I have access to the controls which @JGH describes! Yay! QGIS 3 Symbology Dialog with Line-Stroke control enabled This may indeed be the same as in QGIS 2.18. I must not have tried to customize the line-stroke of a polygon-edge while using 2.18. While searching this issue, I did not encounter instructions which advised that polygon-edge symbology control is different, and that one must select for Outline:Simple line in order to add controls to the dialog box. I hope this helps others with the keywords I have laid out.

BTW I tried to add this as a comment to @JGH's answer, but [CTRL]+[G] did not add images to a comment; so I created this as an answer to my own question. But @JGH gets credit for the vital hint.

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.