1

I have two layers; one is the foreground and the other a background. Both layers have fields containing similar values (field values in the foreground layer (mun_code) is also present in the background layer's fields (ADM3_PCODE). For instance, both fields may contain the value 012802000).

For the background layer, I am trying to use Rule-based styling to add a thicker border using the expression:

@mun_code = attribute( $currentfeature, 'ADM3_PCODE' )

but @mun_code returns NULL (most likely because mun_code as a field is only present in the foreground layer while the background layer contains the field ADM3_PCODE):

Rule-based styling problem

I already Generated an atlas choosing the foreground layer as the Coverage layer. My understanding is that $currentfeature (in the code above) is already automatically controlled by the Print Composer Atlas, so I am wondering why it returns NULL.

How can I fix this?

JAT86
  • 932
  • 5
  • 17
  • 1
    maybe some of this might help: https://gis.stackexchange.com/questions/173399/filtering-features-in-other-layers-of-qgis-atlas – DPSSpatial_BoycottingGISSE Mar 23 '19 at 14:13
  • Thank you very much for the info. I managed to fix it using one rule having the expression "ADM3_PCODE" = attribute( @atlas_feature , 'mun_code') for feature of interest and another rule "ELSE" for features of no interest on the background layer. – JAT86 Mar 23 '19 at 15:00
  • 1
    There are other filters for doing intersects, etc. within the atlas feature layers... very powerful! – DPSSpatial_BoycottingGISSE Mar 23 '19 at 15:38

1 Answers1

2

@ is for QGIS integrated reserved variables ... i think u meant "mun_code" (keeping the double quotes) to reference the attribute value ... But your aim remains unclear to me : Did u build any relation between the two tables ? Relation based on attributes (has any join been setup ?) or based on geography ? If u want to test the content of an attribute located in another table you have to define a clear relation.

Snaileater
  • 5,743
  • 1
  • 15
  • 26
  • Thanks. I did a table join, and also used double quotes but no difference. I think the main problem is like in this question: https://gis.stackexchange.com/questions/290844/filtering-a-layer-with-attribute-value-from-another-layer-in-qgis-2-18 but the answers did not do any difference neither. – JAT86 Mar 23 '19 at 10:39