<html><head></head><body><div dir="auto">Hello,<br>Stefan, You wrote "display", and while it may be expensive, what about using a symbology, categorized or rule-based, in which your expression will do the job? I didn't look at the exact expression, but it will look for features that intersect the current canvas extent, sort and filter them using the arrays functions. The ones that don't meet the criteria will be applied no symbol.<br><br>Regards,<br>Harrissou</div><br><br><div class="gmail_quote"><div dir="auto">Le 4 mai 2025 00:47:18 GMT+02:00, chris hermansen via QGIS-User <qgis-user@lists.osgeo.org> a écrit :</div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div dir="auto"><div><div>Stefan and list,</div><br><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Sat, May 3, 2025, 11:53 Stefan Keller via QGIS-User <<a href="mailto:qgis-user@lists.osgeo.org">qgis-user@lists.osgeo.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear all,<br>
<br>
I would like to display only say the 50 most important features of a<br>
layer in a QGIS project when I zoom out and in. Almost all features<br>
have an attribute qrank starting at NULL or 1, and the larger qrank<br>
is, the more "important" the object is. Here is a demo of the web app<br>
<a href="https://castle-map.infs.ch/" rel="noreferrer noreferrer" target="_blank">https://castle-map.infs.ch/</a><br>
<br>
You can set a filter by right-clicking on the layer, e.g. as follows:<br>
SELECT * FROM “castles_etc_ranked_osm_2025” ORDER BY qrank DESC LIMIT 50;<br>
<br>
The problem is that QGIS only applies this filter (and SQL) once (when<br>
setting up the filter). However, I want QGIS to update this filter and<br>
reapply it every time someone's zooming or panning.<br>
<br>
I have looked in vain at the options for “Update Layer with notify” in<br>
the layer menu in the “Display” tab. I also tried it with a view and<br>
the file manager, but without success.<br>
<br>
1. Can QGIS be configured this way? E.g. with Dynamic Provider Filter Plugin?<br>
2. I think a small Python script (QGIS Python Console) could be<br>
another solutions. But which signals would I need to intercept?<br>
<br>
Yours, Stefan<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">What if you turn off the cache? So that the query has to be re-evaluated on each draw?</div><div dir="auto"><div class="gmail_quote gmail_quote_container"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>
</blockquote></div></body></html>