0

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 Mar 12 at 13:51
0

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

  1. your actual field names instead of "field1", etc.
  2. 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 Mar 12 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 Mar 12 at 18:09
0

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' )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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