[QGIS-Developer] Advice? Sneaky trick for call out labels
Tim Sutton
tim at kartoza.com
Wed Apr 10 15:54:18 PDT 2019
To clarify a little, I am trying to avoid the label text crossing the call-out line.
Regards
Tim
> On 10 Apr 2019, at 23:02, Tim Sutton <tim at kartoza.com> wrote:
>
> Hi Friends
>
> So I am using logic like this* to make call out labels using a geometry generator:
>
> make_line(
> closest_point($geometry,
> make_point( "auxiliary_storage_labeling_positionx" , "auxiliary_storage_labeling_positiony" )),
> make_point( "auxiliary_storage_labeling_positionx" , "auxiliary_storage_labeling_positiony" )
> )
>
> The line runs from the closest point along the edge of the polygon to the bottom left corner of the label box. With this configuration it works well when my ‘lollipop’ callout label is north-east of the polygon being labelled:
>
> <Screenshot 2019-04-10 at 22.54.29.jpg>
>
> But doesn’t work when the label is e.g. south west of the polygon:
>
> <Screenshot 2019-04-10 at 22.54.54.jpg>
>
> Now I am wondering if we have any options for getting the geometry of the label box so I can do the reverse and get the closest point along the edge of the label box to the polygon being labelled. So my question:
>
> Is there any sneaky trick for getting the geometry of the label box for a feature in an expression? And no, using an opaque background for my label to mask away the call out line doesn’t really hack it. I know the label box isn’t being calculated at the time the polygon is being rendered so the answer is probably ’no’ but maybe someone else has a clever idea to make may lollipops work when labels are south (or east or west for that matter) of the feature being labelled?
>
> Thanks!
>
> Regards
>
> Tim
>
>
>
> —
>
>
> <KartozaNewLogoThumbnail.jpg>
>
>
>
>
>
>
> Tim Sutton
>
> Co-founder: Kartoza
> Ex Project chair: QGIS.org <http://qgis.org/>
>
> Visit http://kartoza.com <http://kartoza.com/> to find out about open source:
>
> Desktop GIS programming services
> Geospatial web development
> GIS Training
> Consulting Services
>
> Skype: timlinux
> IRC: timlinux on #qgis at freenode.net <http://freenode.net/>
>
> I'd love to connect. Here's my calendar link <https://calendly.com/timlinux> to make finding time easy.
>
—
Tim Sutton
Co-founder: Kartoza
Ex Project chair: QGIS.org
Visit http://kartoza.com <http://kartoza.com/> to find out about open source:
Desktop GIS programming services
Geospatial web development
GIS Training
Consulting Services
Skype: timlinux
IRC: timlinux on #qgis at freenode.net
I'd love to connect. Here's my calendar link <https://calendly.com/timlinux> to make finding time easy.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20190410/38837a10/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: KartozaNewLogoThumbnail.jpg
Type: image/jpeg
Size: 6122 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20190410/38837a10/attachment-0001.jpg>
More information about the QGIS-Developer
mailing list