3

If I create point data and label them with callouts, I have the following problems:

  1. The callouts will cross each other
  2. The Text is over the points
  3. It seems quite messy

enter image description here

I want to automate this because I have over 200 points and don't want to manually change the position of each label. I have seen, that there is a geometry generator & Data Override option, but haven't found any useful information on the web.

Specified [What I want]:

  1. Each point should be labelled.
  2. The callouts should not cross each other
  3. The labels should not overlap with the points.

My sample data: Sample Data.

4
  • 3
    Can I suggest you also share your current style settings (at least the key ones) - file and/or screenshot - so that people can easily replicate your starting point. Nov 26, 2023 at 5:43
  • 4
    @TomBrennan I have attached the style settings in the geopackage itself. I think if you open the layer it should automatically set the layer settings. Or is this not the case? Nov 26, 2023 at 16:19
  • 5
    (1) should be controllable by changing the Rendering->Overlapping labels setting. You can probably fix (3) to some extent by using Simple (Point) Markers rather than a (Polygon) Geometry Generator. (2) is likely to be the tricky one - the callouts are driven by the label positioning, so you have little control over callouts crossing labels or other callouts. You can write a data defined expression for the preferred label direction - but it's not going to be easy, and may need to be quite specific to your dataset. Hard to tell whether that's possible from the small example set. Nov 27, 2023 at 5:16
  • @TomBrennan Thank you. I wish QGIS could implement, that the Callout-Lines would not cross. Isn't there a way to do this by an existing algorithm? Dec 7, 2023 at 17:13

1 Answer 1

6

Regarding point 3: If your intention was to use a geometry generator for the symbol to make it behave like a polygon in terms of label settings, that won't work. You need to use the geometry expression under the geometry generator for labels instead (Labels > Placement tab).

Firstly, the expression you used for your geometry generator symbol was exterior_ring(make_circle($geometry, 2)) which is actually a linestring output, not a polygon.

So let's change this to make_circle($geometry, 2) and use it in the labels geometry generator, selecting Polygon/MultiPolygon output geometry.

You will now get label placement options for a polygon. Select Outside Polygons and your labels will be more likely to not overlap the point symbol.

enter image description here

This might make the labelling behave a little more like what you like, although as the comments to your post suggest, it's hard to tell with a small sample set, and avoiding callout line crossover is not a straightforward thing with current versions as far as I know.

Maybe play around with the label geometry generator expression, for the example below shown at 1:400 I used make_circle($geometry,4)

enter image description here

3
  • Thank you. Number 3 is clear for me. Thank you. Do you have any ideas how to archive number 2? @she_weeds Dec 7, 2023 at 17:12
  • 2
    Do you mean save the label positions? You could use field calculator to save the auxiliary label xy fields to actual xy fields and then when you reapply the style in a different project use those actual xy fields to control label position.
    – she_weeds
    Dec 7, 2023 at 20:18
  • Yes, exactly. see: gis.stackexchange.com/questions/471590/… Dec 8, 2023 at 10:09

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.