Hi Alexis, Régis and Nyall I went with Nyall’s approach for now since I was 90% there and he gave me the last nudge I needed :-) I used data defined alignments:
Here are the expressions I used for horizontal: if ( X(closest_point($geometry, make_point( "auxiliary_storage_labeling_positionx" , "auxiliary_storage_labeling_positiony" ))) > X(make_point( "auxiliary_storage_labeling_positionx" , "auxiliary_storage_labeling_positiony" )), 'Right', 'Left’) Which gives (animated gif, open in browser if needed): And Vertical if ( Y(closest_point($geometry, make_point( "auxiliary_storage_labeling_positionx" , "auxiliary_storage_labeling_positiony" ))) < Y(make_point( "auxiliary_storage_labeling_positionx" , "auxiliary_storage_labeling_positiony" )), ’Top’, ‘Bottom’) Which gives (animated gif, open in browser if needed): @Régis I will give your plugin a try to see what it does too, thanks! QGIS Rocks! Regards Tim > On 11 Apr 2019, at 07:19, Régis Haubourg <regis.haubo...@gmail.com> wrote: > > Hi Tim, > You can have a look at easycustomlabeling plugin code. It's sets those > expressions for label alignement. > > FYI I should be working on a new version of it taking profit of the geometry > generators power soon , and we might be able to revive the QEP47 to revive > the idea of porting this natively to core. > Best regards > Regis > > Le jeu. 11 avr. 2019 à 00:54, Tim Sutton <t...@kartoza.com> a écrit : > 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 <t...@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 >> >> Visit 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 to make finding time easy. >> > > — > > > > > > > > > > Tim Sutton > > Co-founder: Kartoza > Ex Project chair: QGIS.org > > Visit 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 to make finding time easy. > > _______________________________________________ > QGIS-Developer mailing list > QGIS-Developer@lists.osgeo.org > List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer > <KartozaNewLogoThumbnail.jpg> — 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.
_______________________________________________ QGIS-Developer mailing list QGIS-Developer@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer