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

Matthias Kuhn matthias at opengis.ch
Mon Apr 27 08:55:02 PDT 2015


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.

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?

Thank you for any feedback,
Matthias

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20150427/a671d5a7/attachment.pgp>


More information about the Qgis-developer mailing list