1

I am a beginner in QGIS. I'm using QGIS 3.32.

I have several rectangular symbols that are sometimes close together or overlapping. Each symbol has its own size (ellipse marker, width and height defined by data with expressions), with transparent background. All symbols must have their own label. I have moved by hand the labels of the most congested areas (see image, simplified example), but I still cannot optimally resolve callouts start anchor.

I have set the label placement in Cartographic, and distance offset "From Symbol Bounds", but I can't get the line to start at the edge of the symbol, it always starts from the centroid. With a little Pythagoras I was able to get it closer, but it's not perfect.

Is it possible to make the callout line start just at the edge of the symbol?

enter image description here

I read many answers about use Geometry Generator, but I have not achieved good results, I lack too much knowledge on that topic, and sometimes it's a bit confusing where to write the GG expressions.

2
  • You could convert your points to real polygons and then label those?
    – Erik
    Sep 20 at 6:32
  • It is a layer generated from a CSV file, is it possible to convert them to polygons? I would like to maintain the possibility of editing the CSV data...but I can explore the idea.
    – Trekkium
    Sep 20 at 13:57

1 Answer 1

2

There may be several ways to put the labels outside the polygons, but I will suggest one method that could be helpful:

  1. Right the polygon boundary and select Duplicate layer.

enter image description here

  1. Put the duplicate layer on top of the original polygon layer
  2. Activate Callout in the original polygon layer, and select Point on exterior from the Feature anchor point.

enter image description here

  1. Go to placement, and under Mode in the General settings, and select Outside Polygons.
  2. Set the distance to the desired offset distance.

enter image description here

  1. For the copied layer (duplicate layer) created in the first step, go to labels, select Blocking, and under Minimize placing labels, select Over the feature's interior.

enter image description here

Here are the results before and after the blocking:

Before:

enter image description here

After:

enter image description here

4
  • Will this work with transparent polygons?
    – Erik
    Sep 20 at 6:31
  • @Erik Do you mean transparent without fill color?
    – ahmadhanb
    Sep 20 at 9:35
  • Idk, OP wrote "Each symbol has its own size (ellipse marker, width and height defined by data with expressions), with transparent background."
    – Erik
    Sep 20 at 12:30
  • Thanks for your answer! I have followed the steps, but I don't see the same options, such as "Outside Polygons" mode or "Over the feature's interior". I think the layer type is different. To clarify, the data source is a layer created from a CSV file that I update externally. Ideally, I would need to be able to make changes to the data and have them reflected on the map (like add new rows)
    – Trekkium
    Sep 20 at 13:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.