Many thanks for the tip, Harrissou. While I love e.g. data-driven rule-based symbology geometry generators, I am really looking for a solution that scales. And that means you want to filter the data close to the source and not during rendering.
I would rather go in the direction that Chris has pointed out. For example, he referred to this discussion https://gis.stackexchange.com/questions/392447/filter-features-within-bounding-box-on-provider-side . I also looked at this plugin https://plugins.qgis.org/plugins/qgis-subset-expression-plugin/ and there's even a built-in xxx option as combined with PostgreSQL NOTIFY https://gis.stackexchange.com/questions/336820/using-postgresql-notify-payload-in-qgis . I think I'm close to a solution using the "Filter" property of layers, but it seems that this probably needs a QGIS patch to instruct the layer to refresh/reload/recalculate the source. Many QGIS expression variables are already available, such as SELECT * FROM "castles_etc_ranked_osm_2025" WHERE "x" BETWEEN $x_min AND $x_max AND "y" BETWEEN $y_min AND $y_max ORDER BY qrank DESC LIMIT 50; or SELECT * FROM "castles_etc_ranked_osm_2025" WHERE "x" BETWEEN min_x(@map_extent) AND max_x(@map_extent) AND "y" BETWEEN min_y(@map_extent) AND max_y(@map_extent) ORDER BY qrank DESC LIMIT 50; --Stefan P.S. For those who want to test it themselves: Here's the dataset with the castles of Switzerland and the corresponding field qrank for their ranking according to the worldwide QRank dataset: https://drive.switch.ch/index.php/s/RsYy9oBxWfad1am Am So., 4. Mai 2025 um 07:17 Uhr schrieb DelazJ <del...@gmail.com>: > > Hello, > 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. > > Regards, > Harrissou > > > Le 4 mai 2025 00:47:18 GMT+02:00, chris hermansen via QGIS-User > <qgis-user@lists.osgeo.org> a écrit : >> >> Stefan and list, >> >> >> On Sat, May 3, 2025, 11:53 Stefan Keller via QGIS-User >> <qgis-user@lists.osgeo.org> wrote: >>> >>> Dear all, >>> >>> I would like to display only say the 50 most important features of a >>> layer in a QGIS project when I zoom out and in. Almost all features >>> have an attribute qrank starting at NULL or 1, and the larger qrank >>> is, the more "important" the object is. Here is a demo of the web app >>> https://castle-map.infs.ch/ >>> >>> You can set a filter by right-clicking on the layer, e.g. as follows: >>> SELECT * FROM “castles_etc_ranked_osm_2025” ORDER BY qrank DESC LIMIT 50; >>> >>> The problem is that QGIS only applies this filter (and SQL) once (when >>> setting up the filter). However, I want QGIS to update this filter and >>> reapply it every time someone's zooming or panning. >>> >>> I have looked in vain at the options for “Update Layer with notify” in >>> the layer menu in the “Display” tab. I also tried it with a view and >>> the file manager, but without success. >>> >>> 1. Can QGIS be configured this way? E.g. with Dynamic Provider Filter >>> Plugin? >>> 2. I think a small Python script (QGIS Python Console) could be >>> another solutions. But which signals would I need to intercept? >>> >>> Yours, Stefan >> >> >> What if you turn off the cache? So that the query has to be re-evaluated on >> each draw? _______________________________________________ QGIS-User mailing list QGIS-User@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user