[Qgis-developer] Python - granular access to rules in rule-based renderer

Tom Chadwin tom.chadwin at nnpa.org.uk
Thu Apr 16 03:19:08 PDT 2015


I'm implementing rule-based rendering in qgis2leaf. I know I can get the
filterExpressions with:

qgis.utils.iface.mapCanvas().layers().rendererV2().rootRule().children().filterExpression()

However, filterExpressions are in "SQL-like" syntax. I need to transform
these into JavaScript:

QGIS:  "name"  LIKE '%a%'
JS: feature.properties.name.indexOf('a') != -1

At the moment, I am facing a whole load of messy regexps to cover all
possible expressions (probably impossible). Is there more granular access to
the filterExpression than retrieving the whole string? That could allow me
to build the JS programmatically, which could be possible.



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Python-granular-access-to-rules-in-rule-based-renderer-tp5201632.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.


More information about the Qgis-developer mailing list