2

I'm developing a QGIS plugin along with PostGIS and I'm facing some problems with labeling. This plugin creates several layers and tables. Some of these layers are views (labeling layers), so if I edit the one fo the source layer the view changes and then the label. I explain more detailed:

I have the following:

  • One layer. Let's call it layer1.
  • One none spatial table. Let's call it table1.
  • One spatial view from these other two layers layer1 and table1 meant for labeling. Let's call it labelView1.

The point is this, when I edit table1 adding a new element linked by a foreign key with layer1. The label position in labelView1 changes into a messy thing. The Style of labelView1 is the following:

  • Symbol is a geometry generator. Since I want to create callouts from label to the geometry, wich is a point.
  • The position of the label is saved on project. In the qgd file.

I have seen this behaviour in Windows10 and in Ubuntu. The QGIS version is 3.4, but I tried to move to the new 3.10 version of QGIS, with the callouts new feature, but is the same result.

As well I tried to reproduce it in a much simple way, but without succed, that's why I want to share a link with a GIF file showing this issue:

https://gifyu.com/image/vMY7

I've done the same but without fixed position,and the labels don't move, but the geometry_generator does.

Is there any way to prevent it if this is a bug?

1 Answer 1

1

I reply myself.

Nop, is not a bug. What happened is the following. The labeling layer used the id in order to save the label position into the project database. Once the layer was updated, the id changed, and then all the labels sometimes, or some in others, switched positions with other geometries.

That was. Once I fixed the ID, the problem was solved.

Your Answer

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

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