[Qgis-developer] Expression to get label reference point X and Y for use with geometry generator (make_line) ?

kimaidou kimaidou at gmail.com
Thu May 4 05:39:38 PDT 2017


Hi QGIS !

I am playing with data-defined label position, with 2 column label_x and
label_y.
I use a geometry generator to draw the line between the label and the
feature centroid, like

make_line(
  centroid( $geometry ),
  make_point( "label_x", "label_y" )
)

It work pretty well (with some rectangle background under the label text),
but it is obviously only active when the label_x and label_y fields are not
NULL ( when the label is pinned )

I would like to draw this line for any features (perhaps depending on this
line length). So basically, I would need 2 new functions $x_label and
$y_label.

Anyone has tried to achieve this ?

Cheers,
Michaƫl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20170504/43ce04eb/attachment.html>


More information about the QGIS-Developer mailing list