[Qgis-developer] QgsFeatureRequest::FilterType are mutually exclusive

Hugo Mercier hugo.mercier at oslandia.com
Tue Apr 28 00:50:51 PDT 2015


Hi Matthias,

Le 27/04/2015 17:55, Matthias Kuhn a écrit :
> Hi all,
> 
> I am currently working on an "expression compiler". This will allow to
> execute (some) expressions server side. Currently postgres is the main
> target but it can be adapted to others as well. This makes it very easy
> to write provider-independent code that is able to make use of database
> indexes, reduce network traffic and relocate CPU usage to a server. I
> will write more about this later.

Nice. Looking forward to read this :)

> 
> One thing that I am currently working on is to apply this to the
> rule-based renderer. Especially for small-scale situations where a lot
> of features are in the visible extent but only a small fraction meeting
> certain criteria shall be rendered this can improve rendering speed.
> 
> The problem that I am currently facing is, that the feature request does
> not allow combining a filterRect (extent) and an expression, since you
> can either set the request to filter by extent OR by expression.
> 
> I thought about removing the FilterRect type and instead always combine
> it with the active filter type. E.g. if the filterType is
> filterExpression "class = 2" and a rect is set the two clauses will be
> joined by an AND. This may change the behavior of existing code in some
> cases but probably not much. Worse is that all providers will need to be
> revised to change this behavior...
> Another option would be to set the filterType to Expression and append
> an "AND INTERSECTS ..." to the expression. Probably this has to be done
> conditionally only for providers that can compile expressions because
> such a solution would bypass spatial indexes that work with filterRect
> (but not with the INSERSECTS operator).
> 
> I am trying not to overcomplicate this. Are there any opinions, ideas,
> caveats, etc. that others can think of?

Yes, IMHO filterXXX() is there to express a possible use of indexes. So
I would be to keep filterRect() and filterExpression() and then remove
filterType.
For backward compatibility, we could decide to filter only by expression
if a filterRect is also present.



More information about the Qgis-developer mailing list