4

example of the attribute table showing features from other sections that extend past section lines

I am running a report in QGIS 3.28.3 to map features within square-mile sections. The report is running off the sectcode field of that layer. There are attribute tables in the report layout that reference the map to give more information specific to sites contained within. My issue is features that extend into adjacent square mile sections are being pulled into the attribute tables.

Ideally, they would only show features that are designated as being associated with that section. In the picture sections 18, 20, and 30 have sites showing that I want to filter out.

My guess is that the solution would be something like using the Filter with check box where an attribute of the features, in this case, sectcode, matches the sectcode of the report feature. All features within that section have an attribute field that matches exactly the same field in the PLSS sections (sectcode). I don't know if this is possible, or how to reference the report feature in the QGIS code.

2
  • 5
    A lot of text to read... Difficult to follow and understand your point. Can you post a screenshot? Share sample data?
    – Babel
    Commented Mar 27, 2023 at 15:35
  • 2
    @Babel I trimmed down some of the trouble shooting and added a picture for clarity. Ultimately the issue is features from adjacent square mile sections are getting pulled into the attribute tables that I want specific to the section being rendered. In this case only sites from section 020219- would be generated in that table.
    – John
    Commented Mar 28, 2023 at 14:09

1 Answer 1

2

You can use the @atlas_... function in Report layouts too, as the Group layer apparently works identically to the atlas layer in regular map layouts.

In the 'Filter with' expression dialog, the active layer reference is the layer with features in the attribute table - so any field references will be in relation to that layer, not the Group/atlas layer.

To equate the sectcode field in your attribute table layer (which is referred to as "sectcode"), to the corresponding sectcode field in your atlas/Group layer (which will need to be referenced using attribute() and the special variable @atlas_feature, for example in here), try the following expression:

"sectcode" = attribute(@atlas_feature, 'sectcode')

I believe there is still no way to preview whether it's worked or not without exporting the report to pdf/images.

1
  • Thank you! That is exactly what I was looking for. That same expression also fixed a similar problem with labels of adjacent sections being pulled into the report.
    – John
    Commented Mar 30, 2023 at 13:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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