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

Martin Dobias wonder.sk at gmail.com
Tue Nov 4 07:11:16 PST 2014


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).

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)


Cheers
Martin


More information about the Qgis-developer mailing list