4

I have a polygon layer that I want to show with different symbologies. When I select a line pattern fill without a stroke line, I want the patterns of adjacent polygons to to blend seemlessly into each other. But QGIS gives the follwing result:

Adjacent line fill patterns in QGIS

What I want is a result like for example in BricsCAD:

Adjacent hatch paterns in BricsCAD1

The line fill hatches of adjacent polygons blend seemlessly because by default all hatches use the same base point (the origin of the coordinate system (0|0) ). So without bordering lines, mutiple polygons look like a single one:

Adjacent hatch paterns in BricsCAD2

Is it possible to get an equivalent result in QGIS without creating a new layer with mutiple adjacent polygons merged into a single one?

2 Answers 2

6

To trick is to add a style that "merges" all polygons to one single feature. It is for visualization only, so the original geometry remains unchanged: Simply create a new symbol layer, apply a Geometry Generator symbology and use this expression to create one single polygon:

collect_geometries(array_agg($geometry))

Now apply a line pattern symbology.

Polygon layer with single polygons in blue/black outline. Added a red line pattern for the symbol layer created with geometry generator: enter image description here

1
  • 1
    Thank you very much @Babel! :-) The geometry generator is a great idea to solve my problem!
    – oekoplaner
    Commented Jul 4, 2021 at 7:56
3

As proposed by @Jack in this similar post, one can style each geometry and and common reference point. Doing so will align the line patterns between all rendered geometries (they could even be on different layers!).

The geometry generator expression should be union($geometry, make_point(-180,-90))

Let's note that each geometry is rendered once only, so it is more efficient than the other answer that requires, for every feature, to merge all geometries of the layer.

It is important that the reference point be to the south-west of every feature. For lat-longs, use -180;-90.

enter image description here

1
  • Thanks for pointing me to that different solution! Will try it on monday!
    – oekoplaner
    Commented Jul 17, 2021 at 14:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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