6

I've been trying to find a way to automatically distribute icons and labels from different data sources so that they don't cover each other at any scale.

The PDF will have the data showing at this scale and so I can't just reduce the size of the icon or it won't be visible.

enter image description here

Issue 1 - this label should move to the left to not cover the icons.

Issue 2 -these icons should automatically distribute with an arrow rather than be on top of each other.

The settings I have for 1 are basically enter image description here enter image description here

I know this can be done with the label move options to an xy position but then when the map zoom level changes this would get affected and we need to print at different scales.

The settings for 2 are basically enter image description here

I would like this to look like the following which is the layout exported as SVG and then edited in Inkscape

enter image description here

Is there a geometry generator code that would automatically distribute the icons and add an arrow (from the closest vertex) to indicate where it's supposed to be?

Another solution could be if there is a way to just move labels and objects in the print composer without impacting the placement in the map.

Here's an example of what Solution 1 for the icon issue from Corentin Lemaitre looks like

enter image description here

1

1 Answer 1

4

There is two subject

For your issue icons overlapping you can use two solutions :

  1. If all your point that need to not overlap are in the same layer then you can use the styling properties of your layer. With this you can show every point without overlapping but you cannot give information on the location of the related point (in your example you have drawn lines to connect icon to real point, it will not be possible with this option). In the symbology of your layer choose the setting Point displacement then set the center symbol to be not visible (opacitiy 0%) and the displacement line to be not visible too. enter image description here
  2. Using text label to act as icon you can have connection between your icon and the location of the feature but you can do only really simple icon containing text and setting would take more time, and you could have no automatic legend based on that. Go to the symbology save your rendering rules you made before to go back to it if you want then set it to no symbols. Then you have to go to Labels properties and create back your symols based on labels styling option. You can set the value to be : CASE WHEN "FEATURETYPE" LIKE 'State%' THEN 'SES' ELSE left("FEATURETYPE", 1) END . To add a colored rectangle you can use Background and set a formula to have the color to depend on the "FEATURETYPE" field. Then add callouts and choose placement around the point with the value that suits your needs. Many option could be used to show always icon or to choose cartographic placement with defined quadrant possibility or to choose text color. enter image description here

Then your second issue is overlapping text and label.

If you have choose option 1 for the first issue then in the icon layer you have to go to label setting and choose blocking. Your icon will always be visible. enter image description here

If you have choose option 2 for the first issue then you can choose to high priority for your icon layer and low priority for you label of road layer.

5
  • Great...so option 1 works (and draws lines when I used Grid displacement) but I should have been clear that not all the points are in a single layer. So it works when the symbols are in the same dataset but not when they aren't. The labels work well -the symbols had no labels and so I didn't think of options in that.
    – GeorgeC
    Commented May 17, 2021 at 21:15
  • 1
    To make the function displacement work you have to use only one layer with your point data you want to show with overlapping, so may be consider to merge your data (permanently or on virtual layer) OR you can use option 2 based on label that will work for different layer and resolve the conflict but need more adjusments. Commented May 18, 2021 at 9:51
  • 1
    The lines shown with the placement method Gird is only lines connecting the nodes to make a group. If you zoom out to get many point grouped you will see that it is not line connecting to real point location but lines connecting point in the same group... but it would work if you have only group of 2 points. Commented May 18, 2021 at 9:58
  • I merged the layers virtually yesterday as I needed to complete the maps. It doesn't show the actual place it's from but it does make it clear that the points are in that area and the icon is not in the actual location. I'll update the question with what it looks like for other users and accept your answer. Your labels hack is a good one and I will keep that in mind for the future.
    – GeorgeC
    Commented May 18, 2021 at 21:42
  • Great thanks to show the result Commented May 19, 2021 at 6:00

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.