[Qgis-user] Labeled grouping by geometry

Richard McDonnell richard.mcdonnell at opw.ie
Mon Jun 25 04:32:40 PDT 2018


Emilio,
I have a partial solution, its not perfect.
Create two new columns called:-

 1. |*wnt *with |/*/*geomToWKT*/( /*$geometry*/ )*/ ||
 2. |*disp_label *with values of*0 *as default, then update with the
    following|
 3. |/*CASE WHEN count("wnt","wnt") > 1 THEN 1 ELSE 0 END*/|

What this does is to mark all duplicate geometries as *1*, which you can 
filter.... the only issue so far is to allow for the first value to be 
*0*, and mark the remaining!
You can then use, under*Rendering *the data defined Show rendering, with 
a simple expression like /*"disp_label" = 0 */you can only display the 
unique values!

Apologies for it only being a partial solution, but maybe someone can 
improve on it!
Regards,

Richard.

REFERENCED:
https://gis.stackexchange.com/questions/72198/add-wkt-representation-of-the-geometry-as-field-in-qgis
https://gis.stackexchange.com/questions/27822/identifying-duplicate-attributes-in-field-using-qgis



On 25/06/2018 11:28, Emilio Abad Vidal wrote:
> Thank you very much Stefan,
>
> but that solution means having one more layer. But my intention was to apply it in the labeling layer itself, if possible, of course.
>
> Anyway, thanks for the reply
>
> Emilio
>
> ----- Mensaje original -----
> De: "Stefan Giese" <Stefan.Giese at wheregroup.com>
> Para: "Emilio Abad Vidal" <eav at cesga.gal>, Qgis-user at lists.osgeo.org
> Enviados: Lunes, 25 de Junio 2018 11:58:03
> Asunto: Re: [Qgis-user] Labeled grouping by geometry
>
>
> Hola Emilio,
>
> you can try do generate a new virtual Layer with a union of the geometry grouped by the geometry itself and use this one for labeling. The following statement will define your new virtual layer:
>
> select mylayer.labelfield, st_union( mylayer .geometry) from mylayer group by mylayer .geometry
>
>
> The result will be a new layer with no double geometries.
>
> Hope this helps
>
> Best regards
>
> Stefan
> Mit freundlichen Grüßen
> Stefan Giese
> Projektleiter/Consultant
> -----------------------------------
> Aufwind durch Wissen!
> Qualifizierte Open-Source-Schulungen
> bei der www.foss-academy.com -----------------------------------
> WhereGroup GmbH & Co. KG
> Schwimmbadstr. 2
> 79100 Freiburg
> Germany
>
> Fon: +49 (0)761 / 519 102 - 61
> Fax: +49 (0)761 / 519 102 - 11 stefan.giese at wheregroup.com www.wheregroup.com Amtsgericht Bonn, HRA 6788
> -------------------------------
> Komplementärin:
> WhereGroup Verwaltungs GmbH
> vertreten durch:
> Olaf Knopp, Peter Stamm
> -------------------------------
> Am 25.06.2018 um 10:32 schrieb Emilio Abad Vidal:
>
>
> Hello everyone,
>
> I have a problem and I can not find the solution. I would appreciate any help.
>
> I have a layer of lines that represent stretches of electrical conductors. These sections have a point of origin and an end point. One of its attributes is the length of each of the sections.
>
> Some of these sections have the same point of origin and the same ending point, so when I label these lines by their length, this repeated data appears for each of the lines and the data is repeated.
>
> I need that when labeling the layer, only the label of one of the lines appears, that is, that the distance between each of the points is represented. I have tried to do it by means of a labeling based on rules, and some function of aggregation by geometry, so that only one label is shown for each space between points.
>
> I do not get it, so I would appreciate any help to solve this problem.
>
> Thank you very much in advance and greetings
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

-- 
*_Richard McDonnell_*
*GIS Specialist PgD GIS AssocSCSI*
*OPW FRM Data Management*
*52 Stephens Green, Dublin 2.*
TEL: 01 6476543


On 25/06/2018 11:28, Emilio Abad Vidal wrote:
> Thank you very much Stefan,
>
> but that solution means having one more layer. But my intention was to apply it in the labeling layer itself, if possible, of course.
>
> Anyway, thanks for the reply
>
> Emilio
>
> ----- Mensaje original -----
> De: "Stefan Giese" <Stefan.Giese at wheregroup.com>
> Para: "Emilio Abad Vidal" <eav at cesga.gal>, Qgis-user at lists.osgeo.org
> Enviados: Lunes, 25 de Junio 2018 11:58:03
> Asunto: Re: [Qgis-user] Labeled grouping by geometry
>
>
> Hola Emilio,
>
> you can try do generate a new virtual Layer with a union of the geometry grouped by the geometry itself and use this one for labeling. The following statement will define your new virtual layer:
>
> select mylayer.labelfield, st_union( mylayer .geometry) from mylayer group by mylayer .geometry
>
>
> The result will be a new layer with no double geometries.
>
> Hope this helps
>
> Best regards
>
> Stefan
> Mit freundlichen Grüßen
> Stefan Giese
> Projektleiter/Consultant
> -----------------------------------
> Aufwind durch Wissen!
> Qualifizierte Open-Source-Schulungen
> bei der www.foss-academy.com -----------------------------------
> WhereGroup GmbH & Co. KG
> Schwimmbadstr. 2
> 79100 Freiburg
> Germany
>
> Fon: +49 (0)761 / 519 102 - 61
> Fax: +49 (0)761 / 519 102 - 11 stefan.giese at wheregroup.com www.wheregroup.com Amtsgericht Bonn, HRA 6788
> -------------------------------
> Komplementärin:
> WhereGroup Verwaltungs GmbH
> vertreten durch:
> Olaf Knopp, Peter Stamm
> -------------------------------
> Am 25.06.2018 um 10:32 schrieb Emilio Abad Vidal:
>
>
> Hello everyone,
>
> I have a problem and I can not find the solution. I would appreciate any help.
>
> I have a layer of lines that represent stretches of electrical conductors. These sections have a point of origin and an end point. One of its attributes is the length of each of the sections.
>
> Some of these sections have the same point of origin and the same ending point, so when I label these lines by their length, this repeated data appears for each of the lines and the data is repeated.
>
> I need that when labeling the layer, only the label of one of the lines appears, that is, that the distance between each of the points is represented. I have tried to do it by means of a labeling based on rules, and some function of aggregation by geometry, so that only one label is shown for each space between points.
>
> I do not get it, so I would appreciate any help to solve this problem.
>
> Thank you very much in advance and greetings
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

-- 
*_Richard McDonnell_*
*GIS Specialist PgD GIS AssocSCSI*
*OPW FRM Data Management*
*52 Stephens Green, Dublin 2.*
TEL: 01 6476543

OPW - Ag féachaint don am atá le teacht - Ag caomhnú ón am atá thart
OPW - Looking to the future - Caring for the past

***********************************************************
Email Disclaimer: http://www.opw.ie/en/disclaimer/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20180625/47e87e30/attachment.html>


More information about the Qgis-user mailing list