[QGIS-Developer] Labelling misplaced

Luís Miguel Royo Pérez luis.miguel.royo at gmail.com
Mon Nov 11 08:33:37 PST 2019


Of course, here is:

















*case when "auxiliary_storage_labeling_positionx" < $x and
"auxiliary_storage_labeling_positiony" > $y and
abs("auxiliary_storage_labeling_positiony"-$y) <
abs("auxiliary_storage_labeling_positionx"-$x) THEN  make_line($geometry,
make_point($x-abs("auxiliary_storage_labeling_positiony"-$y),"auxiliary_storage_labeling_positiony"),make_point("auxiliary_storage_labeling_positionx",
"auxiliary_storage_labeling_positiony"))when
 "auxiliary_storage_labeling_positionx" < $x and
"auxiliary_storage_labeling_positiony" > $y and
abs("auxiliary_storage_labeling_positiony"-$y) >=
abs("auxiliary_storage_labeling_positionx"-$x) then   make_line($geometry,
make_point($x,abs("auxiliary_storage_labeling_positionx"-$x)+$y),make_point("auxiliary_storage_labeling_positionx",
"auxiliary_storage_labeling_positiony"))when
"auxiliary_storage_labeling_positionx" < $x and
"auxiliary_storage_labeling_positiony" < $y and
abs("auxiliary_storage_labeling_positiony"-$y) <
abs("auxiliary_storage_labeling_positionx"-$x) THEN   make_line($geometry,
make_point($x-abs("auxiliary_storage_labeling_positiony"-$y),"auxiliary_storage_labeling_positiony"),make_point("auxiliary_storage_labeling_positionx",
"auxiliary_storage_labeling_positiony"))  when
 "auxiliary_storage_labeling_positionx" < $x and
"auxiliary_storage_labeling_positiony" < $y and
abs("auxiliary_storage_labeling_positiony"-$y) >=
abs("auxiliary_storage_labeling_positionx"-$x) then   make_line($geometry,
make_point($x,$y-abs("auxiliary_storage_labeling_positionx"-$x)),make_point("auxiliary_storage_labeling_positionx",
"auxiliary_storage_labeling_positiony"))when
"auxiliary_storage_labeling_positionx" >= $x and
"auxiliary_storage_labeling_positiony" > $y and
abs("auxiliary_storage_labeling_positiony"-$y) >
abs("auxiliary_storage_labeling_positionx"-$x) then --quadrant ur
alternatif  make_line($geometry,
make_point($x,"auxiliary_storage_labeling_positiony"-abs("auxiliary_storage_labeling_positionx"-$x)),make_point("auxiliary_storage_labeling_positionx",
"auxiliary_storage_labeling_positiony")) when
"auxiliary_storage_labeling_positionx" >= $x and
"auxiliary_storage_labeling_positiony" > $y and
abs("auxiliary_storage_labeling_positiony"-$y) <
abs("auxiliary_storage_labeling_positionx"-$x) then    make_line($geometry,
make_point($x+abs("auxiliary_storage_labeling_positiony"-$y),"auxiliary_storage_labeling_positiony"),make_point("auxiliary_storage_labeling_positionx",
"auxiliary_storage_labeling_positiony"))  when
"auxiliary_storage_labeling_positionx" >= $x and
"auxiliary_storage_labeling_positiony" <= $y and
abs("auxiliary_storage_labeling_positiony"-$y) >
abs("auxiliary_storage_labeling_positionx"-$x) THEN   make_line($geometry,
make_point($x,$y-abs("auxiliary_storage_labeling_positionx"-$x)),make_point("auxiliary_storage_labeling_positionx",
"auxiliary_storage_labeling_positiony"))  when
"auxiliary_storage_labeling_positionx" >= $x and
"auxiliary_storage_labeling_positiony" <= $y and
abs("auxiliary_storage_labeling_positiony"-$y) <
abs("auxiliary_storage_labeling_positionx"-$x) THEN  make_line($geometry,
make_point($x+abs("auxiliary_storage_labeling_positiony"-$y),"auxiliary_storage_labeling_positiony"),make_point("auxiliary_storage_labeling_positionx",
"auxiliary_storage_labeling_positiony"))     END*




El lun., 11 nov. 2019 17:15, Régis Haubourg <regis.haubourg at gmail.com>
escribió:

> Hi Luis, can you share your geometry generator expression please?
> regards
> Régis
>
> Le lun. 11 nov. 2019 à 09:04, Luís Miguel Royo Pérez
> <luis.miguel.royo at gmail.com> a écrit :
> >
> > Hello everyone,
> >
> > 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 this a bug? Is there any way to prevent it?
> >
> > Thanks.
> > --
> > Luís Miguel Royo Pérez.
> > Analista-Programador GIS
> > C/ Antic Regne de Valencia nº 4. Manises (Valencia)
> > Teléfono:+34  679846103
> > webs:
> > inisig.com
> > geofibra.com
> >
> >
> > _______________________________________________
> > QGIS-Developer mailing list
> > QGIS-Developer at lists.osgeo.org
> > List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20191111/abed5330/attachment.html>


More information about the QGIS-Developer mailing list