1

I have a PostGIS DB populated with OSM data (osm2pgsql). I defined styles for several features. Some are styled, others are not. But every time I update the canvas or load my project, all of the features from the DB are loaded - also the features I don't styled (because they are not important for my task). I'm wondering, If I could save CPU and RAM by pre-filter the features I don't need. I already do that in my line-layer for rivers. The feature filter is simply:

"waterway" IN ('river', 'stream', 'canal')

Just the waterways are loaded and all others, like railways or streets, are filtered out. It's easy in that waterway-case, because the work is done with that small query. But for my polygons and points I have got a way much more complex filter:

enter image description here

Now I would like to use my styling-rules to pre-filter the DB-Import. I know, I could copy and paste... but I need a more comfortable and flexible way (if I change something in the styling and add or delete a feature-class, I have to do the same in the feature filter).

1

Which QGIS version is this? The rule based renderer is recent versions (since maybe 2.12) should automatically calculate the filter and pass it to the provider.

However... The last rule in your list "no filter" looks suspicious. What's that rule set to?

  • So that means, just the features which are styled, are loaded from the provider? That should make my question unnecessary :-) The "no filter" is just for testing reasons. It's deactivated by default. – MAP Nov 19 '16 at 10:24
  • 1
    Yes, if you use simple rules like =,>, like, is null, etc then these filters are compiled and handed off to the postgres database, so that only features which will be rendered are fetched. – ndawson Nov 19 '16 at 11:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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