I work on QGIS 3.4.4 Madeira. I have two related layers in my project :"towns" (polygon) and "interest points" (points), the common field is "town name".
In the Atlas, my cover layer is "towns".
I would like to put labels wich display values from different fields of the child layer ("interest points") corresponding to the current entity of the Atlas. It seems easy but I can't find the correct expression.
My cover layer in the Atlas is "towns" and in each town, I have several "interest points". The layer "interest points" have many fields and I would like to insert data from a given field of the child layer using an expression in the labelling (text) tool and not the table tool. So I need an expression to insert the value inside a sentence for example.
I tried relation-aggregate function, it returns values from child layer but it necessarily "calculates" (min, max, sum...). And I only want to display the child related value.
-
How do u want to aggregate the attributes of your child layer 'interest points' in case there are several points in your 'town' ?Snaileater– Snaileater2019年03月12日 13:51:45 +00:00Commented Mar 12, 2019 at 13:51
2 Answers 2
I'm not sure I understand what you mean by "corresponding to the current entity of the atlas." If you mean points that intersect the current atlas feature, here's an answer:
Use Rule-Based Labeling for the point layer. Create a rule with this filter expression:
within( $geometry , @atlas_feature )
Select the field that you want to label the point with.
You can create a separate rule for each field, or combine multiple fields into a single label. Use an expression such as this:
concat( "field1", '; ', "field2", '/', "field3", '-+-+-+-', "field4" )
The label will look like this: field1; field2/field3-+-+-+-field4
. Be sure to substitute
- your actual field names instead of
"field1"
, etc. - the text or punctuation you want between the fields instead of
'; '
and'/'
and'-+-+-+-'
-
I feel he wants to label the cover layer ("towns") with attributes coming from the point layer ("interest points") ... no ?Snaileater– Snaileater2019年03月12日 17:59:58 +00:00Commented Mar 12, 2019 at 17:59
-
I wrote my answer before I realized the question isn't completely clear. Your interpretation seems equally possible. Hopefully the OP will clarify.csk– csk2019年03月12日 18:09:03 +00:00Commented Mar 12, 2019 at 18:09
you could to use one expresions for show only the labels that follow one expresion
in Labels Properties>> Rendering>> Show Labes>> Edit>> add the next expresion
"town name" = attribute( @atlas_feature, 'town name' )