Date 2025/07/22
Author Julien Cabieces (@troopa81)
Contact julien dot cabieces at oslandia dot com
Version QGIS 4.0
This proposal relates to the line symbol layer which draw markers or hashes at intervals along a line. When using such symbol layer, the display of the repeated pattern (hash or marker) can be ugly, and user would like to have a better control on what's displayed.
The rest of the proposal will mention markers but everything describe here applies also to hashes.
In order to have a proper display of the markers along the line, I propose to give user a way to identify blank areas where markers are not displayed. This could look like approximatively this
User could then use another point layer with marker symbol to place and rotate other marker where he wants to.
These areas would be defined as start and end distances from the first point of the line or polygon. It would be possible to define the unit of those distances.
While it will be possible to use screen or page based units like millimeters or inches, it is expected that this will be of limited use as the blank regions would then change size and position when the map scale is changed. Rather, it is expected users will typically set the region distance unit to "Map units" or "Meters at scale" so that the regions remain fixed in place regardless of the map scale. Accordingly, the default unit for the property will be set to Map Units.
A new Property would be added to the QgsSymbolLayer enum and it would be possible to explicity set a data defined property for all QgsTemplatedLineSymbolLayerBase symbol layers (which marker line and hash line symbol layer inherits from). It would be possible then to define those blank areas either:
- with a specific data field,
- an auxiliary data storage field,
- an expression.
This property will be a string of comma separated distances.
When used with a field, this information would then be stored per feature, per layer, per symbol layer.
A new widget would be inserted within marker line symbol layer widget.
It won't be possible to edit statically those areas because:
- We consider there are few use cases where user would like to define blank areas for ALL features
- There could be misunderstanding between the static distances and the ones created with the maptool, making believe user than the later can edit the former
- It will still be possible to define distances array thanks to expression
A new map tool QgsMapToolDefineBlankArea will allow to define these blank areas.
The new map tool will be accessible through the symbology editor ( in the screenshot above, even though a new icon will be proposed), and only here (because you need to choose the symbol layer you are going to add the blank areas).
Button to activate this map tool would be disable if the symbology editor is not docked, because:
- The properties window is modal and need to be closed before starting to add blank lines
- User need some direct visual feedback when defining those blank areas
A tooltip will explain why when it's disabled.
This tool will allow to:
- Click in the neighborhood of the line to start creating an area, click again to finish editing the zone like on the video above.
- Select an area, press
Delkey to remove it - Drag the start/end of an already existing area and move it along the line to reduce/enlarge it
- Drag the zone entirely and move it along the line
the map tool defined zone would be set on QgsTemplatedLineSymbolLayerBase symbol layers as data defined properties. If no data defined property has been set, a window would ask user if he wants to generate an auxiliary storage layer and which field he wants to use to join.
QgsMapToolDefineBlankArea will reuse part of the logic already defined in the label map tool
QgsMapToolDefineBlankArea will define its own rubber band class QgsMapToolBlankAreaRubberBand to edit the areas. It would retrieve symbol layer offset, and layer geometries within the view extent and will use the offsetLine method to properly compute the rubber band areas to be drawn (in a way like the one in the above video).
As the blank areas are defined as distances from the starting point of the geometry, it's to be noted that geometry modifications may change the absolute position of the blank areas and the rendering may differ from the original definition.
This is considered acceptable because this feature mainly targets layer that would be subject to few geometry modifications.
Rendering impact would be light. Distances would be sorted and treated accordingly to detect whether or not we need to render the marker or not
- qgslinesymbollayer.cpp
- qgsmaptooldefineblankarea.h
- qgsmaptooldefineblankarea.cpp
None identified at this stage.
As already pointed out, performance could be impacted as soon as fixed mode is enabled but it should remain acceptable and no actual impact would appear on existing project.
None
Full backward compatibility
None



