[Qgis-developer] Is it possible to write classification scripts for the graduated renderer in Python?

Anita Graser anitagraser at gmx.at
Tue Nov 4 11:21:57 PST 2014


On Nov 4, 2014 10:11 AM, "Martin Dobias" <wonder.sk at gmail.com> wrote:
>
> Hi Anita
>
> On Fri, Oct 31, 2014 at 12:46 AM, Anita Graser <anitagraser at gmx.at> wrote:
> > Hi,
> >
> > Is it possible to write classification scripts for the graduated
renderer in
> > Python?
>
> Depends what you mean. If you mean to add another method like Equal
> Interval / Quantiles / Natural Breaks - then you would need to write
> them in C++ and add them to the core library (this is not extensible).

Thanks for the clarification Martin. I was hoping this would be extensible
using Python.

> But of course you can come up with your own classification algorithm
> and create the graduated renderer easily in a Python script:
>
> ranges=[QgsRendererRangeV2(1,100,
> QgsSymbolV2.defaultSymbol(QGis.Point), "1 - 100")]
> r=QgsGraduatedSymbolRendererV2("cat", ranges)
> iface.activeLayer().setRendererV2(r)

I'll probably give this approach a try then.

Best wishes and thanks
Anita
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20141104/66082ca8/attachment.html>


More information about the Qgis-developer mailing list