13

Is it possible in QGIS to connect labels and points with a line/arrow or something?

In my map it is not clear which label goes with its point. I can't bring it closer because there are many more points to come.

enter image description here

0
8
  • First, create labeling fields for X and Y position of your labels in your point table.

  • Activate the X and Y positionning in the properties of your layer.

override

  • Create a new "Generator expression" style in your point style, set it to line type, then use the following formulae :

    make_line(make_point($x,$y),make_point( "LABEL_X" , "LABEL_Y" ))

As an enhancement, you can use various fields (or use a plugin to create them all) to control where the align point will be. You could have the use of a rotation field and a vertical and horizontal alignement field.

styling

The line will move accordingly to your label position, as its arrival point is related to the label positon field.

5

You could try downloading and installing the EasyCustomLabeling plugin from Plugins > Manage and Install Plugins, this creates a duplicated memory layer of your selected vector layer and contains the same attributes.

(Note that you will also need to download and install the Memory Layer Saver plugin to save the memory layer correctly, this is described in the plugin description).

Once your label layer is created, you can play with the label placement and style of that layer to try and get what you're looking for:

Plugin

Label layer settings

Label layer

0
4

Concerning the method by gisinside: the first step of manually adding x/y attributes for labels can be omitted; (maybe since QGIS3?) there's an auxiliary variable for label-positionings already present. The variables ar called accordingly: "auxiliary_storage_labeling_positionx" and "auxiliary_storage_labeling_positiony".

So in Step Nr. 2 you can use this expression to draw lines:

make_line(make_point($x,$y),make_point( "auxiliary_storage_labeling_positionx" , "auxiliary_storage_labeling_positiony"))

Note however, that the auxiliary variables only get a value assigned, if you touch/move the labels with the move-label-tool. Therefore, you only see lines for labels that have been manually moved around.

2

If you are using PostGIS for your spatial data, this post https://sigsemgrilhetas.wordpress.com/2015/01/12/etiquetas-com-guias-em-qgis-e-postgis-labels-leading-lines-with-qgis-and-postgis/ by Alexandre Neto explains how leading lines can be added to the points in your database.

Its a well written tutorial worth reading, it also has a movie in the post that shows how it works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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