3

I have several layers containging points holding information. Some of them are at the exact same locationg (as they originated from the same file, describing varous categories at the same location).

In QGIS I would like the points from the exact same location to be rendered with a slight offset, so that one can see that there are several points at one location. Quite similar to what could be achieved with the Placement option for labels for a single layer, or with the Point Displacement option for symbology, also just for a single layer.

Is there an easy option how this could be achieved for a group of layers so that this offset is not just taking into acout points from a single layer, but from all layers?

I have thought about the following options:

  • Add small ofsets to their x/y location but this is impractical as it is not sensitive to zooming in/out.
  • Merging the files in a single layer. However I would have to do quite complicated layer-styling then as each layer represents a different category (colour-coded) and quantity (size-coded).

EDIT: points from up to 10 layers can be located at anidentical location and none of them should overlap.

1 Answer 1

5

You could try using offset expressions. This will offset points in layer B with a random distance of +-300 m if there is a point in layer A within 10 m of it:

case 
when overlay_nearest(layer:='A', limit:=1, max_distance:=10) then array(rand(-300,300), rand(-300,300)) else array(0, 0) end

enter image description here

2
  • 1
    Hi @BERA, thanks a lot this looks almost exactly like what I was looking for! I should have been more precise though (and I'l edit my question above). There are up to 10 layer which can - in the most extreme case - contain points at the same loation. So I would need to offsett them all with regard to the other layers. The solution you proposed would still work but is a bit cumbersome, I assume.
    – Vincé
    Commented Mar 15, 2023 at 14:00
  • 1
    Maybe you could merge all the layers to one and use that one as the "A" layer in the query
    – Bera
    Commented Mar 17, 2023 at 6:10

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.