[QGIS-Developer] Filtering features in a layer by a report group

Nyall Dawson nyall.dawson at gmail.com
Wed Aug 7 01:53:30 PDT 2019


On Wed, 7 Aug 2019 at 16:23, Tim Sutton <tim at kartoza.com> wrote:
>
> Hi All
>
> I am trying to create a section in my report (not layout) which iterates over my plant types lookup table and applies a filter to my vegetation points layer based on the plant type ID.
>
> Ideally I should set my filter of my vegetation layer based on the atlas feature id like this:  "plant_type_id" = attribute(@atlas_feature,id)
>
> Instead I tried to make a rule using the same above expression so that symbols are blank for non matching plant features.
>
> However in my report group, ‘Controlled by report’ is greyed out for my map and so when rendering the report the map comes out as a single blank copy instead of one per plant type.

You shouldn't need that check box -- that's only used when you want
the map extent to center on the report feature. But, if I'm
interpreting your request correctly, you want a fixed map view but
iterating through different sets of visible features only? If this is
the case it should work fine regardless of the "controlled by report"
setting.

>
> I suspect this is because report wants to have geometries to zoom to for each record.

Only if you want the map extent to vary page-by-page. For fixed extent
maps using geometry-less tables is fine.

> Side note: QGIS layer filtering is a "poor relation” it is one of the few places in QGIS where a non standard expression editor is used.

That's because it's always done on the provider side, so the filter
syntax varies by backend, and can't use all the nice QGIS-only stuff
like variables.

See https://github.com/qgis/QGIS/issues/24932

Nyall


>
>
> Thanks!
>
> Regards
>
> Tim
>>
>
>
>
>
>
>
>
> Tim Sutton
>
> Co-founder: Kartoza
> Ex Project chair: QGIS.org
>
> Visit http://kartoza.com to find out about open source:
>
> Desktop GIS programming services
> Geospatial web development
> GIS Training
> Consulting Services
>
> Skype: timlinux
> IRC: timlinux on #qgis at freenode.net
>
> I'd love to connect. Here's my calendar link to make finding time easy.
>
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


More information about the QGIS-Developer mailing list