9

Using QGIS 2.18.3, I would like to apply a random point pattern to my polygon symbology. The default Style Manager has a regularly-spaced point pattern, called Cemetery-25-50k (please see image below). This is a good starting point, but obviously not random.

enter image description here

Alternatively, I have reviewed the Point Pattern fill options within the Layer Properties (below), but nothing appears that would generate a random pattern.

enter image description here

What I need to recreate is the ESRI Arcmap random point symbology, shown here:

enter image description here

  • one possibility (which allows more control over randomness, and also use abritrary symbols like trees) is to use inkscape to create an SVG (using tiled clones with randomness), and use an SVG fill. – Steven Kay Apr 11 '17 at 19:43
12

You can add random point symbology using the following steps:

  1. Add new symbol layer using the '+' button:

enter image description here

  1. Change the Symbol layer type to 'Point pattern fill'
  2. Highlight 'Point pattern fill' in the left side tree
  3. Change the horizontal and vertical distances to reasonable values. In this example, I chose the same value for both distances of 2.0
  4. 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) 
    
  5. 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) 
    
  6. You need to reduce the symbol size to 2 Pixels

You can see the output in the following image:

enter image description here

In the composer, the legend will look like this:

enter image description here

  • 2
    It doesn't quite duplicate the randomness of the built-in Arc symbology but that's a nice solution. To increase the randomness, use the randf() function on the horizontal and vertical distances and also duplicate the fill several times. – Ed Rollason Apr 11 '17 at 8:21
  • 1
    @EdRollason Thanks for your comment. It is also a good idea to add several layers with randf() function. – ahmadhanb Apr 11 '17 at 9:02
  • 1
    @ahmadhanb Interesting solution, bookmarked! – mgri Apr 11 '17 at 9:54
2

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.

enter image description here

  • 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)

enter image description here

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.