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

Nathan Woodrow madmanwoo at gmail.com
Thu Apr 16 04:28:02 PDT 2015


Hey Tom,

Don't use regex.  You are in for a world of pain if you go that way, and
not the kind of pain you feel good about after.  I will have a better
method for you soon.

- Nathan

On Thu, 16 Apr 2015 at 20:20 Tom Chadwin <tom.chadwin at nnpa.org.uk> wrote:

> 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.
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20150416/d8bff0f2/attachment.html>


More information about the Qgis-developer mailing list