[QGIS-Developer] Labelling misplaced

Luís Miguel Royo Pérez luis.miguel.royo at gmail.com
Tue Nov 12 06:36:49 PST 2019


Hi Régis,

thanks a lot for your insights. Finally I caught the issue. It's easy,
since the labelling layer is a view, everytime this view was updated, the
id, changed, and then the messy thing happened. I fixed already.
Again, thanks ^^

El lun., 11 nov. 2019 a las 18:43, Régis Haubourg (<regis.haubourg at gmail.com>)
escribió:

> Oh ok, expression taken from label connector plugin :)
>
> Be aware that it can be slow with big geometries and that it is a
> temporary approach before having a native one in core (which I'd be
> pleased to have implemented if anyone supports it).
>
> So it seems you have something messing the unique id's that auxiliary
> storage database uses to link your data and qgis projected data when
> you add a new feature. Are you sure your ID's and foreign keys beahve
> like expected on the database side? For the auxiliary storage, a new
> feature shouldn't have any x-y value and thus the label should fall
> back to the automatic labeling options. In your case, it seems the
> newly created feature inherits from the id of another feature. This is
> a common case in labeling, and I remember the famous Mapinfo label
> callout mix ups that occured when compressing datasets, just because
> it didn't use real id's, but line number to identify features.
>
>
> Régis
>
> Le lun. 11 nov. 2019 à 17:33, Luís Miguel Royo Pérez
> <luis.miguel.royo at gmail.com> a écrit :
> >
> > 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
>


-- 
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20191112/e0a06c7e/attachment.html>


More information about the QGIS-Developer mailing list