Creating random point polygon fill symbology in QGIS?
You can add random point symbology using the following steps:
- Add new symbol layer using the '+' button:
- Change the Symbol layer type to 'Point pattern fill'
- Highlight 'Point pattern fill' in the left side tree
- Change the horizontal and vertical distances to reasonable values. In this example, I chose the same value for both distances of
2.0
Under the Horizontal displacement and vertical displacement, use the following functions:
5.1 For Horizontal displacement:
randf(3,5)
5.2 For Vertical displacement
randf(2,4)
Duplicate the point layer and change the horizontal and vertical distances to 6 and 3, respectively. Under the Horizontal displacement and vertical displacement, use the following functions:
6.1 For Horizontal displacement:
randf(0,1)
6.2 For Vertical displacement
randf(1,2)
You need to reduce the symbol size to 2
Pixels
You can see the output in the following image:
In the composer, the legend will look like this:
another technique involves using InkScape to create an SVG, and using an SVG fill layer in QGIS.
It allows more control over symbology (e.g. you could draw randomly scattered trees, not just points) and more control over spacing
- In Inkscape, draw a circle/tree, and select the object
- Edit > Clone > Tiled clones
- Create (say) 5 x 5 or 10x10 tiled clones. It's a good idea to keep the size of the grid small as QGIS will struggle if you have too many symbols.
- In the Shift tab, choose something like this... use the default settings is ok, but change the Randomise setting to add 'jitter'.
Experiment with the settings, you can always click on Remove if the result isn't good.
- Click Create.
- Select all tiled clones using CtrlA
- CtrlShiftD to bring up document properties
- Select Resize page to drawing or selection
- Save as an SVG, but make sure you use Simple SVG format
- Now bring into QGIS as an SVG symbol fill.
Here's one where I made a random grid of 5 x 5 copies of one of the QGIS built-in trees. By experimenting with spacing and jitter you can get different looks. You can also experiment with QGIS' Horizontal Displacement. By setting that to half the horizontal distance, it breaks up the "tiled" look (giving a pattern like bricks in a wall)