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

Tim Sutton tim at kartoza.com
Wed Aug 7 08:37:45 PDT 2019


Hi

> On 7 Aug 2019, at 09:53, Nyall Dawson <nyall.dawson at gmail.com> wrote:
> 
> On Wed, 7 Aug 2019 at 16:23, Tim Sutton <tim at kartoza.com <mailto: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.
> 

Ok but is there a way to access the equivalent of @atlas_feature_id in my style rules when running the report so I can hide vegetation points that don’t match the plant name I am iterating over?	



>> 
>> 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.

OK I am using a fixed extent.

> 
>> 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.

Yup I am aware of the provider part but shouldn’t one still be able to interpolate QGIS expressions (or at least variables) into the filter expression? I am thinking the equivalent here of doing 

Select * from layer_foo where name=“@some_name”

Which gets replaced with the actual name each time a read request  is made.


Thanks!

Regards

Tim


> 
> See https://github.com/qgis/QGIS/issues/24932 <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

—









Tim Sutton

Co-founder: Kartoza
Ex Project chair: QGIS.org

Visit http://kartoza.com <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 <https://calendly.com/timlinux> to make finding time easy.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20190807/4f032b12/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: KartozaNewLogoThumbnail.jpg
Type: image/jpeg
Size: 6122 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20190807/4f032b12/attachment-0001.jpg>


More information about the QGIS-Developer mailing list